Re: UTF-8 to local with #uXXXX escapes



Oler Laursen: 
> Ralf Stephan <ralf ark in-berlin de> writes:
> 
> > Now, I would like output like #u01a8 for Unicode characters.
> > How could one accomplish this? Wouldn't there be need for such
> > a conversion function?
> 
> If you can hook into the framework, you can always write your own
> converter with something like (not checked):
> 
>    string convert_single_char(int chr)
>    {
>      if (char < 127)
>        return string(chr);
>      else {
>        char buf[20];
> 
>        snprintf(buf, 20, "#%4x", chr);
>        return string(buf);
>      }
>    }
> 
> I don't know if you can hook into the framework, but then you could
> always just loop through the string, converting single characters on
> the fly.

I don't see at the moment how I could hook into the framework but
thanks!  Rather, I suspect there is a solution in the g_ namespace which
just has no binding. Reason: From a program that uses libsoup, I got
error output that just looks like what I want. I only am lacking time
to concentrate on where this came from.


ralf




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]