Windows - Unicode (UTF-16) or ANSI.

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
roed

Windows - Unicode (UTF-16) or ANSI.

Post by roed »

Few days ago I modified Image Magick OLE Automation object to proper handle Unicode characters. The idea was simple - convert all parameter strings from UTF-16 (all strings in Automation methods are UTF-16 encoded) to UTF-8 instead of ANSI.

The same problem appears in the command line tools such as convert.exe or mogrify.exe.
In Windows all parameters passed to main function are ANSI encoded by default.
These parameters require conversion from ANSI to UTF-8 before passing to Image Magick functions.
But this is not the same situation such as OLE Automation objects - conversion from ANSI to UTF-8 only gives you that all ANSI encoded characters are properly handled but don't give you access to all Unicode characters. The solution is to use Unicode (UTF-16) version of C runtime library. When Unicode C runtime library is used the main application function is named wmain and all parameters passed to this function are UTF-16 encoded strings. This is situation similar to IM OLE Automation Object - it is possible to use all Unicode characters. But unfortunately Unicode C runtime library cannot be used in Windows 95,98,Me.

So there's two solutions:
  • Use Unicode version of C runtime library and handle all Unicode characters. Application won't be running on Windows 95/98/Me.
  • Use ANSI version of C runtime library and handle ANSI encoded characters only. Applications will be running on Windows 95/98/Me.
Which solution is in your opinion better?
Also there is The Microsoft Layer for Unicode on Windows 95/98/ME Systems - MSLU. In theory using this library allows application using Unicode C runtime library run on Windows 95/98/Me. I've never trying this library. For more information see: http://msdn.microsoft.com/en-us/goglobal/bb688166.aspx.
Post Reply