Windows - Unicode (UTF-16) or ANSI.
Posted: 2009-02-24T02:41:24-07:00
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:
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.
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.
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.