[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can somebody explain to me what u32tochar in /lib/sh/unicode.c is tr
From: |
Chet Ramey |
Subject: |
Re: Can somebody explain to me what u32tochar in /lib/sh/unicode.c is trying to do? |
Date: |
Mon, 20 Feb 2012 22:28:39 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
On 2/19/12 5:07 PM, John Kearney wrote:
> Can somebody explain to me what u32tochar is trying to do?
>
> It seems like dangerous code?
>
> from the context i'm guessing it trying to make a hail mary pass at
> converting utf-32 to mb (not utf-8 mb)
Pretty much. It's a big-endian representation of a 32-bit integer
as a character string. It's what you get when you don't have iconv
or iconv fails and the locale isn't UTF-8. It may not be useful,
but it's predictable. If we have a locale the system doesn't know
about or can't translate, there's not a lot we can do.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/