From: "Vít Ondruch" Date: 2009-08-07T22:49:37+09:00 Subject: R1.9 mixed encoding in file Hello I wonder if it is possible to enforce encoding of string in ruby 1.9. Let say I have following example: C:\enc>echo p 'test'.encoding > encoding.rb C:\enc>ruby encoding.rb # Thats fine. But what if I like to have in single file ASCII, UTF-8 or strings with other encodings, i.e. C:\enc>echo p 'zufällige_žluťoučký'.encoding > encoding.rb C:\enc>ruby encoding.rb encoding.rb:1: invalid multibyte char (US-ASCII) I know that for this particular case I could use directive on top of the file, but I would like to see something in following manner: String.new 'zufällige_žluťoučký', Encoding.CP852 It means read the content in between quotes binary and interpret it according to specified encoding. Vit -- Posted via http://www.ruby-forum.com/.