Hi All,
I want to check whether the input string is in UTF-8 encoding formate, I
googled but didnt get any fruitful results, pls assit me , thanks in
advance.
regards,
Loganathan
Hi All,
I want to check whether the input string is in UTF-8 encoding formate, I
googled but didnt get any fruitful results, pls assit me , thanks in
advance.
regards,
Loganathan
Hi Loganatha,
Please check this link, let me know if this what you are looking for
http://blog.twodividedbyzero.net/2009/11/adding-accept-charset-attribute-to-html.html
Thanks
Pradeepan
On Mon, Dec 26, 2011 at 12:13 PM, loganathan sellappa <
Hi Pradeep,
Thanks for your response, I just need to check the string,
string=“ABCDabcd123”
string.encoding.name
it shows IBM4378, but I want to know whether the string is under UTF-8
encoding format or not
regards,
Loganathan
Hi Loganathan,
I guess this might help you with your issue.
Try using this helper:
http://snippets.dzone.com/posts/show/4527
It puts a method utf8? on the String. So you can grab the String from
mysql
and see if it is utf8:
my_string.utf8?
If is not, then you can try change the encoding of your String using
other
methods like:
my_string.asciify_utf8
my_string.latin1_to_utf8
my_string.cp1252_to_utf8
my_string.utf16le_to_utf8
Maybe this String is saved on mysql in one of these encodings.
On Mon, Dec 26, 2011 at 2:45 PM, loganathan sellappa <
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs