T
Timo Hoepfner
Hi,
What's going on here? Ths is on MacOS X 10.4.4. Looks like =20
Dir#entries returns strings encoded with some encoding I didn't =20
expect. How can I convert the string to UTF8?
$KCODE=3D'UTF8'
require 'jcode'
s=3D"=E4=F6=FC=DF=C4=D6=DC"
puts s.split(//).inspect
# =3D> ["=E4", "=F6", "=FC", "=DF", "=C4", "=D6", "=DC"]
test_dir=3D"/tmp/test"
`mkdir #{test_dir}`
`touch #{test_dir}/#{s}`
f=3DDir.entries(test_dir).last
puts f.split(//).inspect
# =3D> ["a", "", "o", "", "u", "", "=DF", "A", "", "O", "", "U", ""]
Timo
What's going on here? Ths is on MacOS X 10.4.4. Looks like =20
Dir#entries returns strings encoded with some encoding I didn't =20
expect. How can I convert the string to UTF8?
$KCODE=3D'UTF8'
require 'jcode'
s=3D"=E4=F6=FC=DF=C4=D6=DC"
puts s.split(//).inspect
# =3D> ["=E4", "=F6", "=FC", "=DF", "=C4", "=D6", "=DC"]
test_dir=3D"/tmp/test"
`mkdir #{test_dir}`
`touch #{test_dir}/#{s}`
f=3DDir.entries(test_dir).last
puts f.split(//).inspect
# =3D> ["a", "", "o", "", "u", "", "=DF", "A", "", "O", "", "U", ""]
Timo