[gmpi] Re: GMPI req's draft 1 for review.

  • From: Sébastien Métrot <meeloo@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Tue, 07 Dec 2004 15:28:43 +0100

Steve Harris wrote:

On Tue, Dec 07, 2004 at 01:45:57 +1300, Jeff McClintock wrote:


HI,
My point is, both Windows and Mac API use 16bit UNICODE. If you pass my plugin a 8bit string I've got to convert it, I've got to allocate memory to hold the longer 16bit representation. Then if I need to pass it back I've got to convert it back to multibyte.



Actually windows uses UTF-16, and I'm pretty sure OSX uses UTF-8 nativly.



No, Windows uses UCS-2. UTF-16 is a multibyte (variable length) alternative to UTF-8 that works on 16 bits values instead of 8 but on character may still be coded in 32, 48 or more bits. UCS-2 means *every* character is coded on 16 bits. UCS-4 (the unix default for unicode) means 32 bits by Character for *every* characters.
The problem with Other unicode coding than UTF-8 is that they are not ASCII compatible which means that you'll need conversion routines a lot if you want to continue using 8 bit APIs (think about the number of dependecies one can get in a plugin: libjpeg, freetype2, libpng, zlib, libsndfile, etc...). UTF-8 is much more legacy code friendly, even if you still have some work to do to adapt your code without making mistakes (glyph separation is a good example, as is hyphenation).


I've done quite a lot of Japanese, Chinese, Arab, Hebrew, Korean, Russian localization at some point in my career. I personally found that UTF-8 often is a good solution for existing code. If you master all the build chain then wchar_t (UCS-2 on Mac and Win32, UCS-4 on unices) may be a good solution but then you'll need unicode fonts and all that jazz.

Anyway I think it would be nice to have a set of basic character encoding/decoding functions (a la iconv) in the API or in the supporting libs because there is no multiplatform API for that. IConv is unix only (to the extend of my knowledge), Win32 have 3 diferent APIs and MacOSX has another completely diferent one...

Sebastien




---------------------------------------------------------------------- Generalized Music Plugin Interface (GMPI) public discussion list Participation in this list is contingent upon your abiding by the following rules: Please stay on topic. You are responsible for your own words. Please respect your fellow subscribers. Please do not redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: