• Login
Community
  • Login

Dash and Hyphen - no visible difference

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
9 Posts 3 Posters 2.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Robin Tyers
    last edited by Apr 29, 2021, 11:45 AM

    I was trying to debug something which appeared did not appear to have any issues, but it actually contained two very different characters. A dash ( - ) and a hyphen ( – ) which caused my script to fail because of the use of the hyphen. They appear the differently on here as I am writing this, but was using trusty Notepad++ as the text editor, which is where I came unstuck as they looked identical. Is it possible to make these two look more obviously different as they do in other text editors?

    Many thanks,

    Rob

    A 1 Reply Last reply Apr 29, 2021, 11:51 AM Reply Quote 2
    • A
      Alan Kilborn @Robin Tyers
      last edited by Apr 29, 2021, 11:51 AM

      @Robin-Tyers

      Isn’t the simplest answer is to choose a font in Notepad++ where these two characters appear differently?

      R A 2 Replies Last reply Apr 29, 2021, 12:02 PM Reply Quote 2
      • R
        Robin Tyers @Alan Kilborn
        last edited by Apr 29, 2021, 12:02 PM

        @Alan-Kilborn Thank you for that suggestion and yes it does work well! I was not aware of this limitation with the default “Courier New” font after doing a default installation in Windows until I was using a different editor. Many thanks.

        1 Reply Last reply Reply Quote 1
        • A
          Alan Kilborn @Alan Kilborn
          last edited by Apr 29, 2021, 12:03 PM

          Hmmm, it isn’t easy to immediately “pick up” visually, even in a font that does have an “obvious” difference for the characters. You’d almost have to see them both near each other to know which was which.

          This is actually a rather “tough” problem. :-)

          Maybe a visual effect like this is more desirable?:

          d0c310fc-7806-41c7-b1f0-c1b89c8470ae-image.png

          If that’s acceptable, I can go more into how to achieve it.

          R 1 Reply Last reply Apr 29, 2021, 12:17 PM Reply Quote 1
          • R
            Robin Tyers @Alan Kilborn
            last edited by Apr 29, 2021, 12:17 PM

            @Alan-Kilborn Thank you for that. I have had a look at why I picked it up in Notepad rather than Notepad ++ and found that yes the font may be the key. I have now updated to use “Consolas” instead of “Courier New”, which displays the difference far more clearly and is still has very clearly different 1 and lower case L characters. I will never forget this though, just in case the “Consolas” font has it’s own quirks - you just don’t know until you know. Thanks for your time.

            A 1 Reply Last reply Apr 29, 2021, 12:19 PM Reply Quote 2
            • A
              Alan Kilborn
              last edited by Apr 29, 2021, 12:17 PM

              It appears there are a fair number of Unicode dash/hyphen/thingies that appear similarly; I found them here: https://www.compart.com/en/unicode/category/Pd

              And I show how they appear in Notepad++'s default Courier New font, with their U+xxxx notation:

              7824fa1c-1e0f-4c7e-a39f-ba59dbd004e1-image.png

              Ok, so not all would be hard to distinguish, but there’s enough of them with a common “look” that this might be a “problem”, in any font.

              R 1 Reply Last reply Apr 29, 2021, 12:34 PM Reply Quote 3
              • A
                Alan Kilborn @Robin Tyers
                last edited by Apr 29, 2021, 12:19 PM

                @Robin-Tyers said in Dash and Hyphen - no visible difference:

                “Consolas” instead of “Courier New”

                Consolas is indeed a good choice.
                I oscillate between liking Consolas and Fira Code.
                Deja vu sans mono might be a good one as well.

                1 Reply Last reply Reply Quote 2
                • R
                  Robin Tyers @Alan Kilborn
                  last edited by Apr 29, 2021, 12:34 PM

                  @Alan-Kilborn said in Dash and Hyphen - no visible difference:

                  It appears there are a fair number of Unicode dash/hyphen/thingies that appear similarly; I found them here: https://www.compart.com/en/unicode/category/Pd

                  And I show how they appear in Notepad++'s default Courier New font, with their U+xxxx notation:

                  7824fa1c-1e0f-4c7e-a39f-ba59dbd004e1-image.png

                  Ok, so not all would be hard to distinguish, but there’s enough of them with a common “look” that this might be a “problem”, in any font.

                  Wow, I never knew there were that many variations. Thank you for taking the time to highlight that and for the font suggestions.

                  1 Reply Last reply Reply Quote 1
                  • G
                    guy038
                    last edited by guy038 Apr 29, 2021, 4:04 PM Apr 29, 2021, 4:00 PM

                    Hi, @alan-kilborn,

                    Again, as for the https://graphemica.com link, many thanks for pointing us to the https://www.compart.com/en/unicode/ site !

                    Just for information, the main sections are :

                    https://www.compart.com/en/unicode/           :  Home
                    https://www.compart.com/en/unicode/charsets   :  List of Character Sets
                    https://www.compart.com/en/unicode/block      :  List of Unicode Blocks
                    https://www.compart.com/en/unicode/category   :  List of Unicode Categories
                    https://www.compart.com/en/unicode/scripts    :  List of Unicode Scripts
                    https://www.compart.com/en/unicode/html       :  List of HTML Entities
                    
                    https://www.compart.com/en/unicode/search?q   :  List of Unicode Characters 
                    
                    
                    INPUT Examples in the "Search" zone :
                    
                    -    Char                    =>   Character ITSELF
                    
                    -    U+10180  or  &#x10180   =>   Character U+10180                  ( Character :  GREEK FIVE OBOLS SIGN )
                    
                    -    &#10180                 =>   Character U+27C4 = U + Hex(10180)  ( Character :  OPEN SUPERSET )
                    

                    Cheers,

                    guy038

                    1 Reply Last reply Reply Quote 1
                    2 out of 9
                    • First post
                      2/9
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors