roadrunner has asked for the wisdom of the Perl Monks concerning the following question:
My program is importing strings that could contain some non-ASCII characters in them and I'd like to treat those types of string differently.
I've tried:... which should evaluate to true if the string is ASCII only, and and false if there are any non-ASCII characters in it. However, using a simple Arabic string seems to evaluate to true.$mystring =~ m/([\x00-\xff]*)/gi
Note: I'm using ActivePerl 5.6.1 on Win32 so I can't use the Encode module, which is why I'd like to use regex instead.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to determine if string contains non-ASCII characters ?
by moritz (Cardinal) on Aug 19, 2009 at 16:57 UTC | |
by jethro (Monsignor) on Aug 19, 2009 at 17:08 UTC | |
by ikegami (Patriarch) on Aug 19, 2009 at 17:22 UTC | |
by roadrunner (Acolyte) on Aug 19, 2009 at 17:25 UTC | |
by ikegami (Patriarch) on Aug 19, 2009 at 17:54 UTC | |
by moritz (Cardinal) on Aug 19, 2009 at 17:30 UTC | |
by roadrunner (Acolyte) on Aug 19, 2009 at 17:38 UTC |