Are decoded strings without additional attributes and Unicode interchangeable?
Update:
Does it make a difference if I write
subroutine expects decoded strings.
or write
subroutine expects Unicode strings.
?
sub subroutine {
my $unicode = shift;
utf8::upgrade( $unicode );
my $gcs = Unicode::GCString->new( $unicode );
my $colwidth = $gcs->columns();
return $colwidth;
}
Assuming we are talking about decoding a character encoding (UTF-8, cp1252, etc), yes.
Encode’s
decodeproduces a string of Unicode code points. “Unicode string” is a fitting description of the result.Note that “Unicode string” is not an fitting alternative to “strings stored using the UTF8=1 format”. Unlike the strings returned by
decode, a string stored using the UTF8=1 format is not necessarily a string of Unicode code points.