Table of Contents

About

This page shows you how to make the difference between two characters that are really visually similar.

Example

Problem

Are this two characters the same ?

–
-

Solution

To solve this problem, you need to pass them to an application or function to get their code point

Javascript Solution

The first solution is based on javascript but every language should give you a function to get the unicode code point

let codePoint = character.charCodeAt(0).toString(16)

Bash with Hexdump Solution

Diff between Characters with an hex tool such as hexdump on Unix that output hexadecimal digits

Steps:

  • The Character Set is UTF8. We got then hexadecimal in UTF8.
echo $LANG
en_US.UTF-8

echo – | hexdump -C
00000000  e2 80 93 0a                                       |....|
00000004

  • The Hexadecimal in UTF8 of the first character is 2d. This is the unicode character 2d - Hyphen Minus
echo  - | hexdump -C
00000000  2d 0a                                             |-.|
00000002