I've found a workover :
def to_macroman(str)
data = CFStringCreateExternalRepresentation(nil, str,
KCFStringEncodingMacRoman, 0)
if data.nil?
raise "can't retrieve data from `#{str}'"
end
dest = "".force_encoding("MacRoman")
#
# force dest to be of "MacRoman"
#
dest += CFStringCreate
if i make use of the (pseudo) Iconv :
macroman = Iconv.new('macintosh', 'utf-8', str)
i found MacRoman is internally 'macintosh' because :
puts "CFStringConvertEncodingToIANACharSetName(KCFStringEncodingMacRoman) =
#{CFStringConvertEncodingToIANACharSetName(KCFStringEncodingMacRoman)}"
gave me :
Hey all,
I've downloaded and installed the latest and get an error when attempting to
convert from UTF-8 to MacRoman, here is the error message :
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/iconv.rb:40:in
`ns_encoding:': unrecognized encoding `' (RuntimeError)
from
/
Hey all,
i think i've successfully install MacRuby from svn (revision 3886) :
zsh-% which macruby
/usr/local/bin/macruby
zsh-% macruby -v
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]
however i got :
[1]18359 abort ./change_signature_macruby.rb
this is due to the li
2010/3/11 Laurent Sansonetti
> Hi Yvon,
>
> 1.9 encodings in trunk have very little support for now, but we
> significantly improved them in a branch that might get merged into trunk in
> a few days (maybe today). I will post an update here once it's done.
>
> Laurent
>
>
fine thanks !
my script
I have to read an UTF-8 encoded file with accentuated chars.
if i do :
#! /usr/local/bin/macruby
# encoding: utf-8
SIGNATURES_FILE = "/Users/yt/dev/Signature/signatures.txt"
open(SIGNATURES_FILE) do |file|
file.each do |line|
puts line
end
end
i get the correct characters on t