In my database, I have the following entry
id | name | info
1 John Smith Çö ¿¬¼
As you can tell, the info column is displayed incorrectly - in fact it is Korean. In Chrome, when I switch the browser encoding from UTF-8 to Korean ("euc-kr", I think), I really manage to view the text as such:
id | name | info
1 John Smith 횉철 쩔짭쩌
Then I manually copy the text to the information in the database and save, and now I can view it in UTF-8 without switching the encoding of the browser.
Tall. Now I would like to get the same in Rails, and not manually. Therefore, starting from the initial recording, I go to the console and print:
require 'iconv'
u = User.find(1)
info = u.info
new_info = Iconv.iconv('euc-kr','UTF-8', info)
u.update_attribute('info', new_info)
However, in the end I get something like \x{A2AF}\x{A8FA}\x{A1C6} \x{A2A5}\x{A8A2}in the database, not 횉철 쩔짭쩌.
I have a very general understanding of Unicode and coding.
- , ?
- , .
!