# Reading files in UTF-8

**URL:** <https://www.ruby-forum.com/t/reading-files-in-utf-8/113780>\
**Category:** Ruby\
**Created:** [September 4, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/reading-files-in-utf-8/113780 "2007-09-04T21:56:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tlockney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tlockney](https://www.ruby-forum.com/u/tlockney)\
**Post date:** [September 4, 2007, 9:56pm UTC](https://www.ruby-forum.com/t/reading-files-in-utf-8/113780/1 "2007-09-04T21:56:17Z")

</div>

Hello everybody,

I am deseperatly trying to read file encoded in UTF-8, to populate  
the Globalize database. But it seems that the UTF-8 encoding is not  
recognized, and read as an ASCII char. Is there any specific  
manipulation to do to achieve this?  
Thanks in advance for any help…

Thomas L.  
[http://www.8motions.com](http://www.8motions.com)

---

<div class="post-metadata">

**Author:** ![tlockney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tlockney](https://www.ruby-forum.com/u/tlockney)\
**Post date:** [September 5, 2007, 3:26am UTC](https://www.ruby-forum.com/t/reading-files-in-utf-8/113780/2 "2007-09-05T03:26:02Z")

</div>

Hi,

At Wed, 5 Sep 2007 04:55:04 +0900,  
tomsoft wrote in [ruby-talk:267587]:

> I am deseperatly trying to read file encoded in UTF-8, to populate  
> the Globalize database. But it seems that the UTF-8 encoding is not  
> recognized, and read as an ASCII char. Is there any specific  
> manipulation to do to achieve this?

UTF-8 is ASCII compatible, so if your data don’t contain any  
multi-byte sequences, they should seem like as ASCII data.

---

<div class="post-metadata">

**Author:** ![tlockney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tlockney](https://www.ruby-forum.com/u/tlockney)\
**Post date:** [September 4, 2007, 10:13pm UTC](https://www.ruby-forum.com/t/reading-files-in-utf-8/113780/3 "2007-09-04T22:13:25Z")

</div>

tomsoft wrote:

> Hello everybody,
> 
> I am deseperatly trying to read file encoded in UTF-8, to populate  
> the Globalize database. But it seems that the UTF-8 encoding is not  
> recognized, and read as an ASCII char. Is there any specific  
> manipulation to do to achieve this?  
> Thanks in advance for any help…  
> require ‘iconv’ is your friend.

[http://ruby-doc.org/stdlib/libdoc/iconv/rdoc/index.html](http://ruby-doc.org/stdlib/libdoc/iconv/rdoc/index.html)
