perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject RE: Little Embperl UTF-8 HOWTO
Date Fri, 26 Nov 2004 06:08:23 GMT
Hi,

Torsten thanks for the HOWTO. I have two annotations:

> 
> Regrettably, that pragma only marks the current lexical scope 
> as being UTF-8. I had to insert [- use utf8; -] at the 
> beginning of each and every Embperl source file I have. A bit 
> unelegant, but I didn't find a better solution (why it is 
> important for Perl to know that input is
> UTF-8 is explained in 6. "the utf-8 flag").
> 

Since Embperl 2.0b10 you can say

EMBPERL_TOP_INCLUDE "use utf8;" 

In your configuration. This will automaticly include this code at the start
of each page, so you don't have to do it manually.

> 
> 8. Embperl and the utf-8 flag
> Strings stored to %udat keep their utf-8 flag, so you don't 
> need to worry about that.
> %fdat is different, however (Gerald has it on the post-2.0 TODO list).
> Here also applies what I said in 7. %fdat can be converted by doing
> 
> foreach my $k (keys %fdat) {
>   utf8::decode($fdat{$k});
> }
> 

Until Embperl handles this automaticly, you should put this into an
application object. That allows you to do this once in init method of the
application object.

Gerald


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message