I have a string with escaped Unicode characters, \uXXXX
, and I want to convert it to regular Unicode letters. For example:
"\u0048\u0065\u006C\u006C\u006F World"
should become
"Hello World"
I know that when I print the first string it already shows Hello world
. My problem is I read file names from a file, and then I search for them. The files names in the file are escaped with Unicode encoding, and when I search for the files, I can't find them, since it searches for a file with \uXXXX
in its name.
\u0048
isH
-- they are one and the same. Strings in Java are in Unicode. – Hot Licksa
,b
,$
,£
, etc) to the integers. E.g., the symbolA
is given number 65, and\n
is 10. This has nothing to do with how strings or characters are represented on disk or in a text file say. UTF-8 is a specification (i.e. encoding) of how these integers (i.e. symbols) are represented as bytes (bit strings) so they can be unambiguously written and read from say a file. – DustByte