LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-21-2007, 04:14 AM   #1
gjagadish
Member
 
Registered: Oct 2005
Location: India
Distribution: Fedora Core
Posts: 88

Rep: Reputation: 15
Unicode Character Check in Perl


Hi,

I have a string in $str.
I need to verify whether that string has unicode characters or not using perl.

How to do that?

thanks in advance
Jagadish
 
Old 08-21-2007, 11:04 PM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
see here for some inspiration
 
Old 08-21-2007, 11:31 PM   #3
gjagadish
Member
 
Registered: Oct 2005
Location: India
Distribution: Fedora Core
Posts: 88

Original Poster
Rep: Reputation: 15
Thanks for ur reply

I hv used following regex to check for unicode characters in a string

if ($str =~ /[^[:ascii]]/)
{
print "Unicode character is there in the string"
}

Now it works
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl: replace character in file vippie Programming 4 03-23-2007 04:26 AM
unicode & frensh character ! ik@z Linux - General 1 05-17-2006 12:07 AM
perl post character escaping kapilcool Programming 3 12-20-2005 07:42 AM
Check to see if a file has a certain character in it krock923 Programming 2 11-25-2004 03:30 PM
perl mysql DBI 400 character limit? tjtoocool Linux - Software 2 01-10-2004 04:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration