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

Re: proper way to create a GString object from an unsigned char *



On Fri, 23 Jul 2004 22:10:22 +0200, David Necas (Yeti)
<yeti physics muni cz> wrote:
> On Fri, Jul 23, 2004 at 12:36:28PM -0700, Adam Monsen wrote:
> > What's the proper way to create a GString object from an unsigned char*?
> >
> > I ask because I'm using libxml, and libxml has a xmlChar type (which
> > is an unsigned char). If I make an xmlChar* = "Hello World", how
> > should I make this into a GString?
> >
> > Is it wrong to just cast xmlChar* to char*, even though xmlChar is an
> > unsigned char?
> 
> It's OK to cast unsigned char* to signed char* and vice
> versa -- if you are working with strings, that is.  If you
> were doing arithmetics with the characters (i.e. using them
> as small integers), then it could be different.

Might there be any UTF-8 issues when I do this cast?

-- 
Adam Monsen <adamm wazamatta com>
http://adammonsen.com/


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