From: Yukihiro Matsumoto Date: 2006-06-22T00:18:30+09:00 Subject: Re: Unicode roadmap? Hi, In message "Re: Unicode roadmap?" on Wed, 21 Jun 2006 23:56:47 +0900, "Dmitry Severin" writes: |I can see one more problem with setting encoding per file and tagging |accordingly string literals in it. Indeed. |Here's small example: | |library code in file some_utility.rb: |# -*- coding: EUC-JP -*- |module SomeUtility | def SomeUtility.fancy_format(str) | "" + str + "" # these literals are tagged as EUC-JP, right? | end |end | |application code in file my_app.rb: |# -*- coding: UTF-8 -*- |require 'some_utility' |puts SomeUtility.fancy_format("an utf8 string") # this literal is tagged as |UTF8 | |If the last call will throw some kind of EncodingMismatchError, how to deal |with that? I recommend using "ascii" encoding, which is default, for library files, unless you are sure in what encoding your input data are. For localization, tools like gettext would help dealing with strings in the native encoding. matz.