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. General Programming
  3. C#
  4. problem with unicode. [modified]

problem with unicode. [modified]

Scheduled Pinned Locked Moved C#
helptutorial
26 Posts 7 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.
  • P Peter_in_2780

    Because that's the way \u_nnnn_ works. Big brother to the \x_nn_ convention for single byte characters. Borrowing a couple of sentences from the Java Language Specification, section 3.2: A Unicode escape of the form \u_xxxx_, where xxxx is a hexadecimal value, represents the Unicode character whose encoding is xxxx. This translation step allows any program to be expressed using only ASCII characters.

    Software rusts. Simon Stephenson, ca 1994.

    D Offline
    D Offline
    David1987
    wrote on last edited by
    #16

    \u_nnnn_ doesn't work any particular way, it's just a string.. Of course it works that way in Java and C# and no doubt some other places as well, but there's no guarantee that it always does and OP should have specified it

    P 1 Reply Last reply
    0
    • D David1987

      \u_nnnn_ doesn't work any particular way, it's just a string.. Of course it works that way in Java and C# and no doubt some other places as well, but there's no guarantee that it always does and OP should have specified it

      P Offline
      P Offline
      Peter_in_2780
      wrote on last edited by
      #17

      Well, this is the C# forum... :doh:

      Software rusts. Simon Stephenson, ca 1994.

      D 1 Reply Last reply
      0
      • P Peter_in_2780

        Well, this is the C# forum... :doh:

        Software rusts. Simon Stephenson, ca 1994.

        D Offline
        D Offline
        David1987
        wrote on last edited by
        #18

        Why does that matter? It's not about the string "\Uanything" (ie a string containing the actual character), but about a string containing "\\Uanything" that has to be converted the the first form. Anything could still be in any form - nowhere did he say that it originates from C# sourcecode.

        P 1 Reply Last reply
        0
        • D David1987

          Why does that matter? It's not about the string "\Uanything" (ie a string containing the actual character), but about a string containing "\\Uanything" that has to be converted the the first form. Anything could still be in any form - nowhere did he say that it originates from C# sourcecode.

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #19

          I didn't have a problem understanding what OP wanted to do. Luc didn't have a problem. Richard didn't have a problem. jschell didn't have a problem. OP didn't have a problem understanding Luc's answers. I'm not going on a troll-feeding expedition. End of discussion.

          Software rusts. Simon Stephenson, ca 1994.

          D L 4 Replies Last reply
          0
          • P Peter_in_2780

            I didn't have a problem understanding what OP wanted to do. Luc didn't have a problem. Richard didn't have a problem. jschell didn't have a problem. OP didn't have a problem understanding Luc's answers. I'm not going on a troll-feeding expedition. End of discussion.

            Software rusts. Simon Stephenson, ca 1994.

            D Offline
            D Offline
            David1987
            wrote on last edited by
            #20

            Actually they all had problems understanding what he meant. Luc's first answer doesn't answer the question, Richard's answer doesn't the question, Luc's first version of his second answer parsed it as decimal aswell IIRC and jschell just noted a problem with what the OP is trying to do.

            Peter_in_2780 wrote:

            I'm not going on a troll-feeding expedition. End of discussion.

            Fuck you. It was a legitimate discussion. You are the troll here, not me.

            modified on Thursday, May 12, 2011 3:42 AM

            L L 2 Replies Last reply
            0
            • P Peter_in_2780

              I didn't have a problem understanding what OP wanted to do. Luc didn't have a problem. Richard didn't have a problem. jschell didn't have a problem. OP didn't have a problem understanding Luc's answers. I'm not going on a troll-feeding expedition. End of discussion.

              Software rusts. Simon Stephenson, ca 1994.

              D Offline
              D Offline
              David1987
              wrote on last edited by
              #21

              And let me remind you, you are wrong. The OP did not specify that the number had to be in HEX, therefore it was not clear.

              1 Reply Last reply
              0
              • P Peter_in_2780

                I didn't have a problem understanding what OP wanted to do. Luc didn't have a problem. Richard didn't have a problem. jschell didn't have a problem. OP didn't have a problem understanding Luc's answers. I'm not going on a troll-feeding expedition. End of discussion.

                Software rusts. Simon Stephenson, ca 1994.

                D Offline
                D Offline
                David1987
                wrote on last edited by
                #22

                Who the fuck upvoted this?

                K 1 Reply Last reply
                0
                • D David1987

                  Actually they all had problems understanding what he meant. Luc's first answer doesn't answer the question, Richard's answer doesn't the question, Luc's first version of his second answer parsed it as decimal aswell IIRC and jschell just noted a problem with what the OP is trying to do.

                  Peter_in_2780 wrote:

                  I'm not going on a troll-feeding expedition. End of discussion.

                  Fuck you. It was a legitimate discussion. You are the troll here, not me.

                  modified on Thursday, May 12, 2011 3:42 AM

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #23

                  David1987 wrote:

                  Richard's answer doesn't the question

                  Precisely, because I did not think the question was clear, and it had already received enough suggestions from other people. BTW I was not confused about the hex/decimal question; as you rightly pointed out the OP did not specify what the number format was.

                  The best things in life are not things.

                  1 Reply Last reply
                  0
                  • P Peter_in_2780

                    I didn't have a problem understanding what OP wanted to do. Luc didn't have a problem. Richard didn't have a problem. jschell didn't have a problem. OP didn't have a problem understanding Luc's answers. I'm not going on a troll-feeding expedition. End of discussion.

                    Software rusts. Simon Stephenson, ca 1994.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #24

                    Now look[^] what you've done. :sigh:

                    The best things in life are not things.

                    1 Reply Last reply
                    0
                    • D David1987

                      Who the fuck upvoted this?

                      K Offline
                      K Offline
                      Keith Barrow
                      wrote on last edited by
                      #25

                      Correcting Univotes now. Luckily my jedi powers are OK, so you'll gain more then you lost :)

                      Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                      -Or-
                      A Dead ringer for Kate Winslett[^]

                      1 Reply Last reply
                      0
                      • D David1987

                        Actually they all had problems understanding what he meant. Luc's first answer doesn't answer the question, Richard's answer doesn't the question, Luc's first version of his second answer parsed it as decimal aswell IIRC and jschell just noted a problem with what the OP is trying to do.

                        Peter_in_2780 wrote:

                        I'm not going on a troll-feeding expedition. End of discussion.

                        Fuck you. It was a legitimate discussion. You are the troll here, not me.

                        modified on Thursday, May 12, 2011 3:42 AM

                        L Offline
                        L Offline
                        Luc Pattyn
                        wrote on last edited by
                        #26

                        David1987 wrote:

                        Luc's first version of his second answer parsed it as decimal aswell IIRC

                        Wrong. I edited to improve the error checking, basically I added s==null || s.Length!=6 || s[0]!='\\' || s[1]!='U' to the if(...) throw statement. Now stop this silly dispute, none of us know exactly what the OP intended, as is often the case, unfortunately. That is why I ended up providing two different answers, assuming one of them would hit the actual question. :)

                        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                        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