On Sep 27, 2008, at 2:28 AM, Michael Selig wrote: > Attached is a patch that implements "Encoding::default_internal". > The aim of this patch is to allow a Ruby programmer to specify a > default encoding that all IO (and I hope other methods) will return > strings in, so that you can deal with the strings without worrying > (too much) about encoding compatibility. Impressive work Michael! > A summary of what this patch does: > 2) Extended the "magic comment" feature to also look for > "internal_encoding: XXXX". If this is found in the MAIN ruby file > only, both the source encoding AND the default_internal are set to > the given encoding. If found in an included source file (eg: > library), it is treated the same way as "encoding:" and sets the > source encoding only. (You shouldn't use it in a library anyhow). This is perhaps the only point I'm not loving. The reason is that I just think it would be nice if source encoding could be sorted out with a single magic comment. Could we instead just expand the current comment to support the -E like syntax: # coding: UTF-16BE:UTF-8 ? Just a thought. On a separate point, I admit that I haven't tested it yet, but I'm curious what affect this will have on the work I did for CSV. Do you have any thoughts on this? I'm praying it will all just work, because CSV already checks incoming encodings and honors an internal_encoding() when it is non-nil. I'm figuring this patch will just cause that value to be set when people are using this feature and CSV will continue to work in their chosen encoding. Do I have that right or is this wishful thinking on my part? Thanks for all your efforts in this! James Edward Gray II