I have a rail project in which there are very syrilic strings I
it works fine on Ruby 1.8 , But Ruby 1.9 considers the source files US-ASCII-encoded unless you have any # encoding at the top of the source: UTF-8 do not comment file. At that time the file is not considered as US-ASCII .
An easy way to tell Ruby is "This app is UTF-8 encoded. Please consider all and any of the included source files as UTF8 is not otherwise declared as" ?
UPDATE:
I wrote "" which automatically adds the encoding directive if it is needed.
Clearly better than implicit. Writing the encoding name is good for your text editor, your interpreter, and whatever file you want to see. Different platforms have different defaults - UTF-8, Windows-1252, Windows-1251, etc. And if you choose one on the other automatically, then you will either obstruct the portability or platform integration. The need for more clear encoding is a good thing.
This may be a good idea to integrate your Rail app with GetText, then all your UTF-8 strings will be separated into short translation files, and your Ruby module will be clean ASCII .
Comments
Post a Comment