in reply to Re: ASCII (latin1) to UTF-8 (with sub latin1_to_utf8 & utf8_to_latin1)
in thread ASCII to UTF-8
sub utf8_to_latin1 { # return( pack("U0C*", unpack( "U*",@_[0]) ) ); return( pack( "C*", unpack("U0U*",@_[0]) ) ); }
Updated: (see sig) So I go and feed the original (commented out) line into the big program and it fails. It worked in the test program on both 5.6 and 5.8. Wander all over and find the 5.8 perluniintro where they explicitly say
just like the original poster. But that didn't work alike on both Perl versions. Played around some more and hit upon the other variant above. This now works in both test and 'real' programs on both Perl versions. (sigh)$native_string = pack("C*", unpack("U*", $Unicode_string));
--
I'm a pessimist about probabilities; I'm an optimist about possibilities. - -
Lewis Mumford
|
|---|