Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. The Magician's String, what you see is not what you get.

The Magician's String, what you see is not what you get.

Scheduled Pinned Locked Moved The Weird and The Wonderful
comsaleshelpannouncementworkspace
39 Posts 15 Posters 0 Views 1 Watching
  • 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.
  • N Nicolas Dorier

    static void Main(string[] args)
    {
    String str1 = "http://toto.com/";
    String str2 = "http://toto.com‏/";
    bool eq = str1 == str2;
    Console.WriteLine(eq); //print false

    str1 = "http://toto.com/";
    str2 = "http://toto.com/";
    eq = str1 == str2;
    Console.WriteLine(eq); //print true
    

    }

    See for yourself, but copy the code, do not retype it. :) I lost hair on this one, bug on an actual project for one customer. But it is a nice trick to do to one of your most hated co worker if his computer is unlocked... Also works in configuration files. ;) This is pure evil though. [UPDATE] With some advice I found even more evil than that.

    "а" == "a" //false

    D Offline
    D Offline
    Dave Kreskowiak
    wrote on last edited by
    #6

    Ohhhh that's evil! I love it! :laugh:

    A guide to posting questions on CodeProject

    Click this: Asking questions is a skill. Seriously, do it.
    Dave Kreskowiak

    1 Reply Last reply
    0
    • N Nicolas Dorier

      Ironnically, the best tool that can show it to you is command line. Even notepad would not show. EDIT : TextPad seems to work

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #7

      Notepad will, with the correct typeface -- try Terminal.

      N 1 Reply Last reply
      0
      • P PIEBALDconsult

        Notepad will, with the correct typeface -- try Terminal.

        N Offline
        N Offline
        Nicolas Dorier
        wrote on last edited by
        #8

        I tried to change font, and encoding, nothing do. I even tried to copy the string in the command line, and don't get the ?. How did you do ?

        P 1 Reply Last reply
        0
        • N Nicolas Dorier

          I tried to change font, and encoding, nothing do. I even tried to copy the string in the command line, and don't get the ?. How did you do ?

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #9

          On the command line I use "Raster fonts" 7x12. (Win 7)

          N 1 Reply Last reply
          0
          • P PIEBALDconsult

            On the command line I use "Raster fonts" 7x12. (Win 7)

            N Offline
            N Offline
            Nicolas Dorier
            wrote on last edited by
            #10

            I also have, I think the problem is that I am using "clink" as my command line program. However, on powershell, I get the missing char ! But Notepad, would not show me anything.

            P 1 Reply Last reply
            0
            • N Nicolas Dorier

              I also have, I think the problem is that I am using "clink" as my command line program. However, on powershell, I get the missing char ! But Notepad, would not show me anything.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #11

              I expect it has to be a non-truetype typeface. I also see it with "Nifty Terminal".

              N 1 Reply Last reply
              0
              • P PIEBALDconsult

                I expect it has to be a non-truetype typeface. I also see it with "Nifty Terminal".

                N Offline
                N Offline
                Nicolas Dorier
                wrote on last edited by
                #12

                Yes you are right on Terminal. It definitively shows me, I was trying other fonts. ;) Need to train myself about what font, truetype, and typeface means :)

                1 Reply Last reply
                0
                • N Nicolas Dorier

                  static void Main(string[] args)
                  {
                  String str1 = "http://toto.com/";
                  String str2 = "http://toto.com‏/";
                  bool eq = str1 == str2;
                  Console.WriteLine(eq); //print false

                  str1 = "http://toto.com/";
                  str2 = "http://toto.com/";
                  eq = str1 == str2;
                  Console.WriteLine(eq); //print true
                  

                  }

                  See for yourself, but copy the code, do not retype it. :) I lost hair on this one, bug on an actual project for one customer. But it is a nice trick to do to one of your most hated co worker if his computer is unlocked... Also works in configuration files. ;) This is pure evil though. [UPDATE] With some advice I found even more evil than that.

                  "а" == "a" //false

                  X Offline
                  X Offline
                  Xmen Real
                  wrote on last edited by
                  #13

                  :thumbsup::thumbsup::thumbsup:

                  TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

                  ----------------------------------------------- 128 bit encrypted signature, crack if you can

                  1 Reply Last reply
                  0
                  • N Nicolas Dorier

                    static void Main(string[] args)
                    {
                    String str1 = "http://toto.com/";
                    String str2 = "http://toto.com‏/";
                    bool eq = str1 == str2;
                    Console.WriteLine(eq); //print false

                    str1 = "http://toto.com/";
                    str2 = "http://toto.com/";
                    eq = str1 == str2;
                    Console.WriteLine(eq); //print true
                    

                    }

                    See for yourself, but copy the code, do not retype it. :) I lost hair on this one, bug on an actual project for one customer. But it is a nice trick to do to one of your most hated co worker if his computer is unlocked... Also works in configuration files. ;) This is pure evil though. [UPDATE] With some advice I found even more evil than that.

                    "а" == "a" //false

                    R Offline
                    R Offline
                    Rage
                    wrote on last edited by
                    #14

                    So, for us mortals, care to explain what is going on here ?

                    ~RaGE();

                    I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

                    N 1 Reply Last reply
                    0
                    • R Rage

                      So, for us mortals, care to explain what is going on here ?

                      ~RaGE();

                      I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

                      N Offline
                      N Offline
                      Nicolas Dorier
                      wrote on last edited by
                      #15

                      Magic. :) str2 is a string with an hidden character. If you copy my code, you copy the hidden character, so this bug follow you in whatever programming language. You can execute the code in debug mode, and see that str2 is length +1 str1. However, I have no idea how I ended up with this hidden character in my code. (the int value of this strange character is 0x200f)

                      N 1 Reply Last reply
                      0
                      • N Nicolas Dorier

                        static void Main(string[] args)
                        {
                        String str1 = "http://toto.com/";
                        String str2 = "http://toto.com‏/";
                        bool eq = str1 == str2;
                        Console.WriteLine(eq); //print false

                        str1 = "http://toto.com/";
                        str2 = "http://toto.com/";
                        eq = str1 == str2;
                        Console.WriteLine(eq); //print true
                        

                        }

                        See for yourself, but copy the code, do not retype it. :) I lost hair on this one, bug on an actual project for one customer. But it is a nice trick to do to one of your most hated co worker if his computer is unlocked... Also works in configuration files. ;) This is pure evil though. [UPDATE] With some advice I found even more evil than that.

                        "а" == "a" //false

                        W Offline
                        W Offline
                        Wonde Tadesse
                        wrote on last edited by
                        #16

                        Compileonline.com[^] will shows you the buggy char on String str2 . Interesting though. :)

                        Wonde Tadesse

                        N V 2 Replies Last reply
                        0
                        • W Wonde Tadesse

                          Compileonline.com[^] will shows you the buggy char on String str2 . Interesting though. :)

                          Wonde Tadesse

                          N Offline
                          N Offline
                          Nicolas Dorier
                          wrote on last edited by
                          #17

                          did not know this tool ! good to know.

                          1 Reply Last reply
                          0
                          • N Nicolas Dorier

                            Magic. :) str2 is a string with an hidden character. If you copy my code, you copy the hidden character, so this bug follow you in whatever programming language. You can execute the code in debug mode, and see that str2 is length +1 str1. However, I have no idea how I ended up with this hidden character in my code. (the int value of this strange character is 0x200f)

                            N Offline
                            N Offline
                            Nicholas Marty
                            wrote on last edited by
                            #18

                            Another thing that bit me before was an UTF-8 preamble or BOM with the bytes 0xEF, 0xBB, 0xBF that got copied from somewhere... :doh:

                            N 1 Reply Last reply
                            0
                            • N Nicholas Marty

                              Another thing that bit me before was an UTF-8 preamble or BOM with the bytes 0xEF, 0xBB, 0xBF that got copied from somewhere... :doh:

                              N Offline
                              N Offline
                              Nicolas Dorier
                              wrote on last edited by
                              #19

                              Already got it, if you create a text file with visual studio, it bites you.

                              1 Reply Last reply
                              0
                              • N Nicolas Dorier

                                static void Main(string[] args)
                                {
                                String str1 = "http://toto.com/";
                                String str2 = "http://toto.com‏/";
                                bool eq = str1 == str2;
                                Console.WriteLine(eq); //print false

                                str1 = "http://toto.com/";
                                str2 = "http://toto.com/";
                                eq = str1 == str2;
                                Console.WriteLine(eq); //print true
                                

                                }

                                See for yourself, but copy the code, do not retype it. :) I lost hair on this one, bug on an actual project for one customer. But it is a nice trick to do to one of your most hated co worker if his computer is unlocked... Also works in configuration files. ;) This is pure evil though. [UPDATE] With some advice I found even more evil than that.

                                "а" == "a" //false

                                F Offline
                                F Offline
                                Freak30
                                wrote on last edited by
                                #20

                                I once read a kind of ironic posting about what you could do to obscrure your code (and this way make yourself irreplacable). One of the topics was using similar letters from different alphabets in variable names. They used the example of the Cyrillic 'a' which looks just like the Latin 'a' but is seen as different by the compiler. I assume you could have reached a similar effect by using a Cyrillic 'r' instead of the Latin 'p' in the URL. :-D

                                The good thing about pessimism is, that you are always either right or pleasently surprised.

                                N P 2 Replies Last reply
                                0
                                • F Freak30

                                  I once read a kind of ironic posting about what you could do to obscrure your code (and this way make yourself irreplacable). One of the topics was using similar letters from different alphabets in variable names. They used the example of the Cyrillic 'a' which looks just like the Latin 'a' but is seen as different by the compiler. I assume you could have reached a similar effect by using a Cyrillic 'r' instead of the Latin 'p' in the URL. :-D

                                  The good thing about pessimism is, that you are always either right or pleasently surprised.

                                  N Offline
                                  N Offline
                                  Nicolas Dorier
                                  wrote on last edited by
                                  #21

                                  Did not know that, this is even more evil than the invisible character. I take some notes. You can spot the invisible char by doing str1.Length, but a Cyrillic 'a'... huhu. :)

                                  B 1 Reply Last reply
                                  0
                                  • F Freak30

                                    I once read a kind of ironic posting about what you could do to obscrure your code (and this way make yourself irreplacable). One of the topics was using similar letters from different alphabets in variable names. They used the example of the Cyrillic 'a' which looks just like the Latin 'a' but is seen as different by the compiler. I assume you could have reached a similar effect by using a Cyrillic 'r' instead of the Latin 'p' in the URL. :-D

                                    The good thing about pessimism is, that you are always either right or pleasently surprised.

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #22

                                    Yes, Unicode can be very handy. "the Greek letter Tau (t) (Unicode U+03A4) which looks enough like the Latin letter T" -- Sorting 'Total' after data values[^]

                                    N 1 Reply Last reply
                                    0
                                    • P PIEBALDconsult

                                      Yes, Unicode can be very handy. "the Greek letter Tau (t) (Unicode U+03A4) which looks enough like the Latin letter T" -- Sorting 'Total' after data values[^]

                                      N Offline
                                      N Offline
                                      Nicolas Dorier
                                      wrote on last edited by
                                      #23

                                      Does the Terminal font trick would find the bug ? :D

                                      1 Reply Last reply
                                      0
                                      • N Nicolas Dorier

                                        Did not know that, this is even more evil than the invisible character. I take some notes. You can spot the invisible char by doing str1.Length, but a Cyrillic 'a'... huhu. :)

                                        B Offline
                                        B Offline
                                        Bernhard Hiller
                                        wrote on last edited by
                                        #24

                                        Well, some phishers used that in web addresses. Then, browsers were changed to show some encoded values in the address bar for such characters. www.dеutsсhеbаnk.соm looks so nice at first view, but Firefox changes it into www.xn--dutshbnk-66g8be6l.xn--m-0tbi nowadays.

                                        1 Reply Last reply
                                        0
                                        • W Wonde Tadesse

                                          Compileonline.com[^] will shows you the buggy char on String str2 . Interesting though. :)

                                          Wonde Tadesse

                                          V Offline
                                          V Offline
                                          VICK
                                          wrote on last edited by
                                          #25

                                          bt it wont catch "a" == "a" :D

                                          We should be building great things that don't exist-Lary Page

                                          W 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups