[redland-dev] C# binding encoding problem

Edd Dumbill edd at usefulinc.com
Wed Sep 22 17:41:59 BST 2004


On Wed, 2004-09-22 at 17:32 +0100, Edd Dumbill wrote:
> 
> > For example, without these changes, stepping through the C code I
> > notice that if I create a "rdfxml" parser, the line: 
> > if(!strcmp(syntax_name, "rdfxml")) { ... 
> > in 
> > librdf_parser_raptor_constructor() fails.
> 
> Hmm, this is interesting but not necessarily wrong. The *Auto methods
> marshal to and from Unicode on Windows.  You can't use strcmp against
> Unicode strings and expect it to work, except with UTF-8 encoded
> strings
> that only contain ASCII characters.

OK, so I'm told that Windows uses UTF-16.

Looks like Mono uses UTF-8, which we've been transparently relying on.

So the fix here in the C# binding is to for us convert the string to
UTF-8 before giving it to the Redland method.

Dave might want to speculate on whether Unicode-aware parameter
processing might be something useful to add to Redland as well, but we
can get round the immediate problem in the C# bindings.

I'll try to get some time to work on this, unless you'd like to take a
crack.

-- Edd






More information about the redland-dev mailing list