开发者

The unicode character from a rails app appears as ??? in the mysql database ,

The unicode character from a rails app appears as ??? in the mysql database (ie when I view thr开发者_开发问答ough putty or linux console), but my rails app reads it properly and shows as intended.I have another java application which reads from the rails database and stores the values in its own database. and try to show in from its database. But in the webpage, it appears like ??? instead of the unicode characters. How is that the rails application is able to show it properly and not the java application. Do I need to specify any encoding within the java application?


You really need to find out whether it's the Java app that's wrong, the Rails app that's wrong, or both. Use PuTTY or a Linux console isn't a great way of checking this, as they may well not support the relevant Unicode characters. Ideally, you should find a GUI which you can connect to the database, and use that to check the values. Alternatively, find some MySQL functions which will return the Unicode code points directly.

It's quite possible that the Rails app is doing the wrong thing, but in a reversible way (possibly not always reversible - you may just be lucky at the moment). I've seen this before, where a developer has consistently used the same incorrect code page when both encoding and decoding text, and managed to get the right results out without actually storing the correct data. Obviously that screws up any other system trying to get at the same data.


You may want to check the connection parameters: http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html

I guess your Java application may use wrong encoding when reading from rails' database, wrong encoding of its own database or in connection with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜