Prev: nokogiri error on snow leopard
Next: Cheap wholesale 2010 World Cup jerseys by paypal and free shipping
From: Daniel Jonson on 12 Jun 2010 20:20 Hi, I have a small problem with requiring files with utf-8 character in the filename. I have a small script which does nothing but require another file that has some norwegian utf-8 characters in its filename. shouldnt this work nicely? My enviroment is: mac os x 10.6.3 ruby-1.9.1-p378 locale is set to: LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL= Textmate is set to utf-8. puts __ENCODING__ says UTF-8: hmm. everything seems to be set correctly but when I try require "øløløløløl" it fails with: ruby-1.9.1-p378 > require "øløløløl" Encoding::CompatibilityError: incompatible character encodings: UTF-8 and US-ASCII from (irb):1:in `require' from (irb):1 from /usr/local/rvm/rubies/ruby-1.9.1-p378/bin/irb:17:in `<main>' and øløløløl.rb is simple: # encoding: utf-8 puts "øløløløl" Any suggestions? isnt utf-8 filenames supported? surely it must be? thanx! -- Posted via http://www.ruby-forum.com/.
From: Daniel Jonson on 13 Jun 2010 14:21 Tried 1.9.2 preview3 and it works! But still no solution found for 1.9.1..... -- Posted via http://www.ruby-forum.com/.
From: Bill Kelly on 13 Jun 2010 16:59 Daniel Jonson wrote: > Tried 1.9.2 preview3 and it works! > > But still no solution found for 1.9.1..... 1.9.1 has barely any support for Unicode paths on Windows. 1.9.2 is much improved, although not 100% (for example Dir.chdir accepts UTF-8 paths, but Dir.pwd cannot return UTF-8 paths. It's not clear whether this will be fixed before the final release.) Regards, Bill
From: Brian Candler on 13 Jun 2010 17:14 Daniel Jonson wrote: > Any suggestions? isnt utf-8 filenames supported? surely it must be? Who knows? If you can find an official spec for how Strings work in ruby 1.9, I'd love to see it. So far what I've managed to reverse-engineer I've documented here: http://github.com/candlerb/string19/blob/master/string19.rb How 'require' is influenced by string encoding I've not tested. It seems to me the logical thing would be to treat filenames as just strings of bytes (as the OS does), but as I say, who knows. -- Posted via http://www.ruby-forum.com/.
From: Bill Kelly on 13 Jun 2010 17:50
Bill Kelly wrote: > > 1.9.1 has barely any support for Unicode paths > on Windows. Sorry... Just noticed this isn't relevant to your platform. |