Re: detecting a UTF-8 string

2007-01-03 Thread Octavian Rasnita
eginners@perl.org Sent: Wednesday, January 03, 2007 5:46 PM Subject: Re: detecting a UTF-8 string 2007/1/3, Octavian Rasnita <[EMAIL PROTECTED]>: Hi, I want to check if a certain string is UTF-8 or not. Maybe you want Encode::Guess[1]. [1] http://search.cpan.org/~dankogai/

Re: detecting a UTF-8 string

2007-01-03 Thread Jay Savage
On 1/3/07, Octavian Rasnita <[EMAIL PROTECTED]> wrote: From: "Jay Savage" <[EMAIL PROTECTED]> > Try to unpack the data--or a chunk of data you feel is large enough to > be representative--with the pattern U0U*. If the unpack succeeds with > no warnings, you have valid utf8. You could try the same

Re: detecting a UTF-8 string

2007-01-03 Thread Octavian Rasnita
From: "Jay Savage" <[EMAIL PROTECTED]> Try to unpack the data--or a chunk of data you feel is large enough to be representative--with the pattern U0U*. If the unpack succeeds with no warnings, you have valid utf8. You could try the same thing with Encode's 'decode_utf8' routine. See perluniintro

Re: detecting a UTF-8 string

2007-01-03 Thread Igor Sutton
2007/1/3, Octavian Rasnita <[EMAIL PROTECTED]>: Hi, I want to check if a certain string is UTF-8 or not. Maybe you want Encode::Guess[1]. [1] http://search.cpan.org/~dankogai/Encode-2.18/lib/Encode/Guess.pm -- Igor Sutton Lopes <[EMAIL PROTECTED]>

Re: detecting a UTF-8 string

2007-01-03 Thread Jay Savage
On 1/3/07, Octavian Rasnita <[EMAIL PROTECTED]> wrote: Hi, I want to check if a certain string is UTF-8 or not. I have tried using is_utf8 from the Encode module, and utf8::is_utf8() but the string is detected wrong. For example, if I have a UTF-8 encoded file and an ANSI encoded file, if I op