views:

180

answers:

1

I am using NSDirectoryEnumerator to get all file names in a particular directory. It works fine until it encounters a Japanese file name. When I print this string (NSString) in gdb it prints a sequence of "?" question mark characters for the unicode part of the file name. If I use fileSystemRepresentationWithPath: to get a c string representation, it prints "\343\202\246\343\202\243\343\203\263\343\203\210\343\202\231\343 [...]". It doesn't make sense in unicode, and if I convert to NSString using UTF-8 encoding, I get back the question marks.

How can I get a valid string that I can use to indicate the correct file system path?

EDIT: This is on the iPhone.

+1  A: 

gdb can't print Unicode, but NSLog() does if you need a debugging aid, and all Cocoa routines should be fine. What real code is failing for you? I mean, granted that gdb doesn't print this correctly, but obviously that's not the actual problem you're trying to solve.

Rob Napier
I didn't know this about gdb. This made me think the content was the problem when in fact it wasn't!
hyn