How to see the difference between two characters (hyphen and dash) ?

Data System Architecture

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





Discover More
Data System Architecture
Hyphen Character Minus

hyphen is a character known as the minus. In unicode, the hyphen has the code point 2d The difference between a hyphen and a dash are difficult to compare. In this case, if you are not sure, you...
Character Map 0248 00f8
Text - Character

A character is: an atomic unit of text (10646ISO/IEC 10646:2000 Character specification] is categorized as a primitive data type A character is the smallest component of written language that has...



Share this page:
Follow us:
Task Runner