I use FTP to list the file attributes on the server. I request the name of file and put them into an array. I print the array directly like this:
NSLog(@"%@", array);
What I got is like this:
\U6587\U4ef6\U540d\Uff1afilename.txt
\U6587\U4ef6\U540d\Uff1afilename1.txt
......
When I want to print the Unicode “\U6587\U4ef6\U540d\Uff1a” to see what it is, I got the compiling error: “incomplete universal character name”.
However, If I print the name instead of the whole array, I can get the name correctly without the Unicode. But I need to do something with the name in the array. I want to know why the Unicode is there, and is it proper to just remove the Unicode then to do something with the real file name?
In C99, and therefore presumably Objective C too, there are two Unicode escapes:
The lower-case
uis followed by 4 hex digits; the upper-caseUis followed by 8 hex digits (of which, the first two should be zeroes to be valid Unicode (and the third should be 0 or 1; the maximum Unicode code point is U+10FFFF).I believe that if you replace the upper-case
U‘s with lower-caseu‘s, you should get the code to compile.On my Mac OS 10.7.4 system, compiling with GCC 4.7.0 (home built), I compiled this code:
and got this output:
I can’t answer why the characters are there, but the colon-like character at the end suggests that the site might be preceding the actual file name with a tag of some sort (analogous to ‘file:’).