[Glass] UTF8 character encoding translation between Pharo and Gemstone

Paul DeBruicker pdebruic at gmail.com
Tue Oct 1 12:55:12 PDT 2013


I've got some unicode stings in my Pharo image that were taken as input
from a Seaside form.  I'm trying to use STON to get them into Gemstone.
 STON parses those strings as DoubleByteString and sends
#decodeFromUTF8.  DoubleByteString does not implement #decodeFromUTF8.
If I implement #decodeFromUTF8 as

DoubleByteString>>decodeFromUTF8
	^self asByteArray decodeFromUTF8

I get a spurious null character (codePoint = 0) inserted by the
primitive and the string I'm attempting to decode doubles in size.  Then
when emitting that string as JSON for a webservice the null characters
are encoded to UTF8 (e.g. \u0000) and sent along.


So that makes me think my implementation of #decodeFromUTF8 is probably
not the way to do it.


Is there a better way that won't result in the extra null characters?

Should I do something to the string in Pharo before sending it along to
Gemstone?

Thanks

Paul


More information about the Glass mailing list