Re: replace chars
- From: orasnita@xxxxxxxxx (Octavian Rasnita)
- Date: Thu, 27 Dec 2007 11:24:26 +0200
From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
"Octavian Rasnita" schreef:I have also seen that length($string) returns the number of bytes of
$string, and not the number of chars (if the string contains UTF-8
chars).
This tells me that you are taking input from an octet buffer that comes
from outside.
Yes, I am getting it from a SQLite database.
my $octets = <>;
my $string;
eval {
$string = Encode::decode("utf8", $octets, Encode::FB_CROAK);
1;
} or {
# malformed input
}
Ok, I can get the size of the string using this code, but please tell me how to get the UTF-8 chars from this string.
After decoding the octets, if I do
my @chars = split //, $string;
then it also returns the octets separately and not the UTF-8 chars.
Thanks.
Octavian
.
- References:
- replace chars
- From: Octavian Rasnita
- Re: replace chars
- From: Tom Phoenix
- Re: replace chars
- From: Gunnar Hjalmarsson
- Re: replace chars
- From: Octavian Rasnita
- Re: replace chars
- From: Gunnar Hjalmarsson
- Re: replace chars
- From: Chas. Owens
- Re: replace chars
- From: Octavian Rasnita
- Re: replace chars
- From: Dr.Ruud
- replace chars
- Prev by Date: Re: replace chars
- Next by Date: beginners-help@perl.org
- Previous by thread: Re: replace chars
- Next by thread: Re: replace chars
- Index(es):
Relevant Pages
|
|