From: "Wolfgang Nádasi-Donner" Date: 2009-04-17T23:07:08+09:00 Subject: [ruby-core:23234] Re: What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? Michael Neumann schrieb: > Can you describe more precise what exactly is your problem. Wouldn't it be > more wise to convert the Ruby libraries to UTF-8, to avoid conversion > problems? If I have control over the libraries, usually no problem exists, but if I use several other libraries, including those coming from *nix systems, the named encodings can appear. If there ist for example a source starting with... # coding: Windows-1252 require 'somelib.rb' # ...which includes class 'Otto' x = Otto.new("���") #...rest of code ...it will give problems if the encodings of 'somelib.rb' is utf-8 (e.g.). In the moment the return code of Kernel#load is always true (if the source exists) and the return code of Kernel#require ist true, if the source was loaded. If these methods return an encoding instead of true, there should be no problems with existing code, because the returned encodig acts like true (every value not false or nil will be interpreted as true in logical expressions). If I can change the example code to... # coding: Windows-1252 unless (require 'somelib.rb') == __ENCODING__ warn 'possible encoding mismatch: somelib.rb' end x = Otto.new("���") #...rest of code ..., It is as least helpful for debugging. In more sophisticated applications the code can be adapted to special needs. Wolfgang N��dasi-Donner