View Single Post
  #7 (permalink)  
Old August 11th, 2011, 10:34 AM
chorny chorny is offline
Authorized User
Points: 93, Level: 1
Points: 93, Level: 1 Points: 93, Level: 1 Points: 93, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2009
Location: Moldova
Posts: 23
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by mnagaraj1983 View Post

I had problem with UTF8 character to XML number entites replacements.

$mystring = "molecules consisting of a larger α chain, which is associated with a smaller β chain in a ";

$CurrentText = HTML::Entities::encode_numeric($mystring);

Output:

molecules consisting of a larger α chain, which is associated with a smaller β chain

RequiredOutput:

molecules consisting of a larger α chain, which is associated with a smaller β chain
You need to indicate that source of your program contains utf-8:
Code:
use utf8;
use HTML::Entities;
$mystring = "molecules consisting of a larger α chain, which is associated with a smaller β chain in a ";

$CurrentText = HTML::Entities::encode_numeric($mystring);
print $CurrentText;
If you receive that string from some other code, for ex. a CPAN module, it is more complex. You will need to see how this module works with utf-8.
Reply With Quote
The Following User Says Thank You to chorny For This Useful Post:
mnagaraj1983 (August 11th, 2011)