qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy Jones" <jimmyjon...@gmx.co.uk>
Subject Re: UTF8 / binary strings in dynamic languages
Date Wed, 21 Aug 2013 12:44:10 GMT
> > AFAIK in perl, if you include unicode characters in a string it'll
> > set the utf8 flag. If you don't include any unicode characters (eg. 7
> > bit ascii, or raw bytes) the flag won't be set. So given a perl
> > scalar that doesn't contain any utf8 characters, you don't know if
> > its a textual string (str16) or a binary string (vbin). There is a
> > is_utf8_string function, but that'll only tell you if the string
> > would be valid utf8, but it could be a binary string that happens to
> > be valid utf8, so that's not really safe.
> You can explicitly mark it as utf8 using utf8::upgrade() though, right? 
> Certainly I tried that in a simple test and the property in question was 
> then sent as str16.

Yes, if I as a user had a string that was textual, I could call utf8::upgrade() to ensure
it got sent as str16. I guess this is similar in concept to calling setEncoding in C++, although
maybe less natural in a dynamically typed language.


To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org

View raw message