[Insight-users] Using ITK with unicode character set
Sean McBride
sean at rogue-research.com
Tue Jul 3 10:35:19 EDT 2007
On 7/3/07 9:55 AM, Nithiananthan, Sajendra said:
>> >I assume that because char type is too small to hold Unicode
>> encoding so I
>> >need to use wchar_t.
>>
>> This assumption is incorrect. I really suggest you read:
>> <http://www.joelonsoftware.com/articles/Unicode.html>
>>
>> char* is perfectly fine for a unicode string that is encoded as UTF8.
>>
>>
>> After reading the above article, the question you should ask (and I
>> don't know the answer) is "What encoding does ITK's
>> SetFileName() expect?".
>>
>
>char * might be perfectly fine for UTF8, but you can't guarantee that the
>Windows File System will understand UTF-8. Windows likes to use wide
>characters for filenames (at least on some systems I've seen) so you have to
>account for that.
That's fine. But you are perhaps missing my point. ITK exposes its own
APIs. It has an API named SetFileName() that takes a char*. As users
of the API, we need to know what encoding it expects. We'd still need
to know even if the parameter was wchar_t, void*, or anything else. The
implementators of the API may have to conditionally convert from that
encoding to whatever encoding a particular OS's file system APIs
desire. That's fine too, but it's also an implementation detail that
users of the API should not care about.
The question remains: What encoding does ITK's SetFileName() expect?
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the Insight-users
mailing list