I forgot to mention, all files are modified from the 2.7.1 release

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Michael Platings
Sent: 06 October 2008 14:29
To: [email protected]
Subject: [osg-submissions] Unicode support for Windows


Hi Robert,
Windows doesn't support the UTF-8 code-page. Therefore any filename
containing a character outside the current code-page cannot be loaded by
OpenSceneGraph.
To fix this I have added a OSG_USE_UTF8_FILENAME advanced option for
CMake (off by default)
When enabled, all file access functions use the wide-character
alternative (e.g. _wfopen instead of fopen). The filename argument is
assumed to be a UTF-8 string which is converted to a UTF-16 string.
 
Thanks,
Michael Platings
 
BTW, here's a good discussion of the problem previously posted by Ben
Discoe. His statement that C++ stream IO doesn't support wide filenames
seems to be true in the standard, however Visual C++ does allow
wide-string filenames.
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

[EMAIL PROTECTED]

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.o
rg> 


______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to