CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Laurent_R] truncating variable with charset: Edit Log



orange
User

Mar 31, 2014, 12:51 AM


Views: 2658
Re: [Laurent_R] truncating variable with charset

thanks Bill and others.
Bill, your program works, but not entirely as expected.
substring doesn't cut properly utf8, so I found this workaround:

Code
my $valid = Encode::decode('utf8', $sstr, Encode::FB_QUIET); 
$sstr = Encode::encode('utf8', $valid);


( http://stackoverflow.com/questions/10953069/perl-trim-utf8-bytes-to-length-and-sanitize-the-data)


(This post was edited by orange on Apr 7, 2014, 10:03 AM)


Edit Log:
Post edited by orange (User) on Apr 7, 2014, 10:03 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives