---Content-Transfer-Encoding: quoted-printable

Bali Bali <bill.z.li / gmail.com> writes:

> pierr wrote:
>> Bali Bali wrote:
>>> 
>> If your ruby version < "1.9"
>> $KCODE = "UTF8"
>> else
>>   #!/usr/bin/env ruby
>>   # encoding: utf-8         <--- this line
>> end
>> 
>> (NOTES : above code is not legal ruby code)
>
> pierr, Thanks! But looks like it is not working for me.
>
> Code v2.0
> --
> $KCODE = "UTF-8"
>
> s1 = "good"
>
> File.new("test.xml", "w+") << s1
> --
>
> It still creates a ANSI file. My Ruby version:
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
>
> It is windows release which should not be related to the issue.
>
> Any idea?

How do you test that it is an UTF-8 encoded file anyway? Ruby won't write
a BOM and thus you won't be able to tell the difference unless your
string actually contains special characters or umlauts. "good" in ANSI
is the same as "good" in UTF :)

-- 
Dominik Honnef
dominikho / gmx.net

---Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkpxL3UACgkQePZ2jI1LDtessgCdEzADZVZGfIwmB85KWYJUY7zP
FKkAoMTGD+7W0J+xkMS2gcOQm2pRUSnw
P3
-----END PGP SIGNATURE-----
---