From: Yukihiro Matsumoto Date: 2007-08-26T01:17:20+09:00 Subject: Re: String#length not working properly in Ruby 1.9 Hi, In message "Re: String#length not working properly in Ruby 1.9" on Sun, 26 Aug 2007 00:51:00 +0900, "Austin Ziegler" writes: |Can we get an alternate form for that as well? -*- is a little |annoying to type; why not: | | # pragma-encoding: utf-8 | |(Done properly with callbacks, that could actually be used to give us |user-created pragmas, too...) "-*-" signs are for Emacs. I just found out "-*-" signs are mandatory for our pragma specifiers (it's not implemented by myself). I will relax this as Python coding pragma (as in PEP-263). # -*- coding: -*- or # coding= or, even # vim: set fileencoding= : will work in the future. |If I do this, though: | | s = File.readlines("foo") | |How do I tell Ruby what the encoding of the string is? s.encoding = |'utf-8'? s.encoding = 'raw'? I need to add optional argument for those methods to specify encoding for reading files. matz.