Reed,

OSG on Windows passes your strings directly to fopen, or the C++ stream 
equivalent.  File paths are assumed to be in the local OS's filesystem 
character set.  This means that e.g. Chinese filenames can be opened on 
computers with Chinese version of Windows, and Western filenames can be opened 
on computer with Western version of Windows.  So, to do exactly what you 
describe below, OSG already does it.

However, it is true that if a Chinese user sent you a file with a Chinese 
filename, you could not open it with OSG on your non-Chinese OS.  To do that, 
OSG would indeed have to add Unicode filename support.  Unicode means that any 
file can be opened on any machine.

To support Unicode ,with the C standard lib on Windows, it is quite easy to 
replace usage of fopen with _wfopen.  However, there are many places in OSG's 
code base where the C++ stream IO is used instead of fopen.  AFAIK, there is no 
_w version of those methods, so OSG is stuck.

Just as a note, this whole thing is delightfully a non-issue on Mac OS X, and 
(some?) flavors of Linux, in which UTF-8 is the filesystem charset, so plain 
old fopen() handles everything.

-Ben

> ----------
> From: Reed McKenna
> Sent: Tuesday, April 22, 2008 4:00 PM
> 
> We build an application for Windows XP using OpenSceneGraph. We have more
> and more users from Asian countries who want to read in files that have
> names with Asian characters. Windows’ NTFS file system stores file names
> in Unicode. How can I have osgDB::readNodeFile (and writeNodeFile, etc.)
> read from and write to these files, using the full NTFS Unicode file name?
> If it is not currently possible, are there any plans in the works to make
> it possible?
> 
> Reed

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to