in reply to Re: The Queensrÿche Situation
in thread The Queensrÿche Situation
One problem remains that I still don't quite understand.
Why does that produce, this:#!/usr/bin/perl use strict; use Encode; use Text::Unaccent::PurePerl; binmode STDOUT, ":utf8"; use utf8; my $string = "Queensrÿche"; no utf8; chars($string); (Encode::is_utf8($string))? print "this is utf8\n" : print "this is NO +T utf8\n"; print "$string\n"; print "unaccented: " . Text::Unaccent::PurePerl::unac_string($string) +. "\n"; exit; sub chars { my $k = shift; my @chars = split("",$k); foreach (@chars) { my $dec = ord($_); my $chr = chr(ord($_)); my $q = qquote($_); print "\t$dec\t$chr\t$q\n"; } } sub qquote { local($_) = shift; s/([\\\"\@\$])/\\$1/g; my $bytes; { use bytes; $bytes = length } s/([[:^ascii:]])/'\x{'.sprintf("%x",ord($1)).'}'/ge if $bytes +> length; return $_;
Is that actually valid utf-8? Shouldn't the ÿ be two bytes (decimal 195 191)? Like this:81 Q Q 117 u u 101 e e 101 e e 110 n n 115 s s 114 r r 255 ÿ \x{ff} 99 c c 104 h h 101 e e this is utf8 Queensrÿche unaccented: Queensryche
81 Q Q 117 u u 101 e e 101 e e 110 n n 115 s s 114 r r 195 - \x{c3} 191 - \x{bf} 99 c c 104 h h 101 e e
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: The Queensrÿche Situation
by aitap (Curate) on Oct 19, 2014 at 20:01 UTC | |
by Rodster001 (Pilgrim) on Oct 19, 2014 at 21:00 UTC | |
|
Re^3: The Queensrÿche Situation
by karlgoethebier (Abbot) on Oct 19, 2014 at 21:02 UTC | |
by Rodster001 (Pilgrim) on Oct 19, 2014 at 21:38 UTC | |
by karlgoethebier (Abbot) on Oct 21, 2014 at 07:56 UTC | |
|
Re^3: The Queensrÿche Situation
by Rodster001 (Pilgrim) on Oct 19, 2014 at 20:00 UTC |