On 10/29/09 12:55 , "A.J.Millan" <a...@zator.com> wrote:

> Now, do you know about some library to conver to and from UTF-8 or UTF-16 to
> UCS-2?
> [4-1b] convert with WideCharToMultiByte(CP_UTF8)

On 10/29/09 12:51 , "Igor Tandetnik" <itandet...@mvps.org> wrote:

> You 
> can use WideCharToMultiByte(CP_UTF8) - I don't quite see why you find it so
> offensive. You can use a third-party library if you are so inclined, e.g. ICU.
> You can roll your own - a conversion between UTF-8 and UTF-16 is pretty
> straightforward. Or, you can simply use SQLite's 16-bit API (e.g.
> sqlite3_bind_text16) and have it convert to UTF-8 for you automatically.
> 

I don't use WideCharToMultiByte: it's windows only.

If you don't want to go to the full ICU, I found that the Unicode.org
implementation is:

- correct (AFAICS)
- light weight (much more so than ICU)
- efficient
- simple to use
- although not very well known/documented/publicized

It's at:

http://www.unicode.org/Public/PROGRAMS/CVTUTF/

You want the two files ConvertUTF.h and ConvertUTF.c

The documentation is in the comments.

So your step 4-1b becomes:

[4-1b] convert with ConvertUTF16toUTF8()

Jean-Denis

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to