Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6929

How change charset of file

Newsgroups comp.lang.ruby
Date 2014-03-06 04:04 -0800
Message-ID <ef50912f-145b-465d-9345-196c58e43ef4@googlegroups.com> (permalink)
Subject How change charset of file
From hirogeek@gmail.com

Show all headers | View raw


Hi,

I try to create file with utf-8 charset.


If I do 

File.open("test.xml", 'w:utf-8') { |f| f.write('<?xml version="1.0" encoding="UTF-8"?>') }

file -I test.xml -> test.xml: application/xml; charset=us-ascii

and I do 

File.open("test.xml", 'w:utf-8') { |f| f.write('<?xml version="1.0" encoding="UTF-8" é?>') }

I add an utf-8 char (é) 

file -I test.xml -> test.xml: application/xml; charset=utf-8

Ruby seem to be adaptative. But I would have alwayse charset utf-8. Can we do this ?

I use ruby 2.1.1

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar


Thread

How change charset of file hirogeek@gmail.com - 2014-03-06 04:04 -0800
  Re: How change charset of file Quintus <quintus@quintilianus.eu> - 2014-03-16 19:30 +0000

csiph-web