Thread overview
Changing to UTF-8
Mar 25, 2005
jicman
Mar 25, 2005
Ben Hinkle
Mar 25, 2005
Manfred Hansen
Mar 26, 2005
J C Calvarese
Mar 26, 2005
Manfred Hansen
Mar 25, 2005
Regan Heath
March 25, 2005
Greetings!

Ok folks, I am sorry, but I have not been able to get UTF-8 to work.  So, let us imagine that I have a subrouting that returns a bunch of XML that is non-UTF-8 to a string,

char[] str = GetNonUTF8Data();

How do I change str to UTF-8 data?  Any help would be greatly appreciate it.

thanks.

jic


March 25, 2005
> How do I change str to UTF-8 data?  Any help would be greatly appreciate it.

There are two options:
1) the ICU binding in mango http://dsource.org/projects/mango/
2) the iconv binding that I can't seem to find anywhere but I remember
seeing... anyone know where the iconv binding is? (ps - I wish we had an
updated community links/libs page...)


March 25, 2005
Ben Hinkle wrote:

>> How do I change str to UTF-8 data?  Any help would be greatly appreciate it.
> 
> There are two options:
> 1) the ICU binding in mango http://dsource.org/projects/mango/
> 2) the iconv binding that I can't seem to find anywhere but I remember
> seeing... anyone know where the iconv binding is? (ps - I wish we had an
> updated community links/libs page...)

I have try to collect some links in a database. http://www.steinmole.de/d_lib

You can search for iconv.

Manfred
March 25, 2005
On Fri, 25 Mar 2005 03:56:03 +0000 (UTC), jicman <jicman_member@pathlink.com> wrote:
> Greetings!
>
> Ok folks, I am sorry, but I have not been able to get UTF-8 to work.  So, let us
> imagine that I have a subrouting that returns a bunch of XML that is non-UTF-8
> to a string,
>
> char[] str = GetNonUTF8Data();

Step 1, don't use char[] to store non UTF-8 data. Use byte[]. eg.

byte[] raw = GetNonUTF8Data();

> How do I change str to UTF-8 data?  Any help would be greatly appreciate it.

Step 2, find/write a routine to convert from your encoding X into UTF-8 and call it.

Ben has suggested some libraries that will do it. Alternately, depending on X, it might be easy/possible to write a routine yourself.

Regan
March 26, 2005
Manfred Hansen wrote:
> Ben Hinkle wrote:
> 
> 
>>>How do I change str to UTF-8 data?  Any help would be greatly appreciate
>>>it.
>>
>>There are two options:
>>1) the ICU binding in mango http://dsource.org/projects/mango/
>>2) the iconv binding that I can't seem to find anywhere but I remember
>>seeing... anyone know where the iconv binding is? (ps - I wish we had an
>>updated community links/libs page...)

I think I found the iconv binding:

http://www.algonet.se/~afb/d/libiconv.d
(from http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/17913)

And a related thread that seemed to devolve into licensing issues:
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/13095


> I have try to collect some links in a database.
> http://www.steinmole.de/d_lib

Cool idea.

> You can search for iconv.
> 
> Manfred

I think you meant this:
http://www.steinmole.de/d_lib/start.cgi

Looks good. I hope you don't mind that I added it to http://www.prowiki.org/wiki4d/wiki.cgi?MoreLinks

-- 
Justin (a/k/a jcc7)
http://jcc_7.tripod.com/d/
March 26, 2005
J C Calvarese wrote:

> Manfred Hansen wrote:
>> Ben Hinkle wrote:
>> 
>> 
>>>>How do I change str to UTF-8 data?  Any help would be greatly appreciate it.
>>>
>>>There are two options:
>>>1) the ICU binding in mango http://dsource.org/projects/mango/
>>>2) the iconv binding that I can't seem to find anywhere but I remember
>>>seeing... anyone know where the iconv binding is? (ps - I wish we had an
>>>updated community links/libs page...)
> 
> I think I found the iconv binding:
> 
> http://www.algonet.se/~afb/d/libiconv.d
> (from http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/17913)
> 
> And a related thread that seemed to devolve into licensing issues: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/13095
> 
> 
>> I have try to collect some links in a database. http://www.steinmole.de/d_lib
> 
> Cool idea.
The idea came in my mind from Ruby Application Archive.
http://raa.ruby-lang.org/
During insert the links in the database, i was surprised
how many libraries and tools there are for D.
> 
>> You can search for iconv.
>> 
>> Manfred
> 
> I think you meant this: http://www.steinmole.de/d_lib/start.cgi

Yes that is OK.
> 
> Looks good.
The most work was to deal with the special character å, ö and so on.

> I hope you don't mind that I added it to http://www.prowiki.org/wiki4d/wiki.cgi?MoreLinks
> 
No problem.

Manfred