develooper Front page | perl.perl5.porters | Postings from March 2007

Re: the utf8 flag (was Re: [perl #41527] decode_utf8 sets utf8 flag on plain ascii strings)

Thread Previous | Thread Next
Juerd Waalboer
March 30, 2007 16:08
Re: the utf8 flag (was Re: [perl #41527] decode_utf8 sets utf8 flag on plain ascii strings)
Message ID:
Marc Lehmann skribis 2007-03-31  0:25 (+0200):
> If you send a compressed string over the network using JSON and decompress
> it, you need to know that. 

Does JSON compress arbitrary data? If so, then the user must do the
decoding and encoding, because arbitrary data only exists in byte form.
Once you dictate any specific encoding, it's no longer arbitrary.

On the other hand, if JSON does text data only, it can just use any UTF
encoding on both sides, and document it like that.

Unless both sides are exactly the same platform (e.g. both Perl), you
need to establish a protocol for sending data anyway. And that protocol
should also describe encoding. If sender and receiver don't agree, you
have a problem.

> I am really frustrated at that. It makes perl as a whole rather
> questionable for unicode use, as you constantly have to think about
> the internals.  And yes, that simply shouldn't be the case.

I maintain that it isn't the case, for almost any programming job,
unless you're indeed doing things with internals.
korajn salutojn,

  juerd waalboer:  perl hacker  <>  <>
  convolution:     ict solutions and consultancy <>

Ik vertrouw stemcomputers niet.
Zie <>.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About