# Having problem in printing out correct character

**URL:** <https://www.ruby-forum.com/t/having-problem-in-printing-out-correct-character/153380>\
**Category:** Ruby\
**Created:** [November 16, 2008, 12:19am UTC](https://www.ruby-forum.com/t/having-problem-in-printing-out-correct-character/153380 "2008-11-16T00:19:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 16, 2008, 12:19am UTC](https://www.ruby-forum.com/t/having-problem-in-printing-out-correct-character/153380/1 "2008-11-16T00:19:21Z")

</div>

Hi all,

I copy some texts from a pdf file and save them in a text file. I  
extract some info from the text file, write them to a yaml file. Then I  
use a script to print out the yaml file. It works OK most of the time.  
But I am a bit annoyed that sometimes it can mess up with some words,  
such as “passÃ©”.  
How am I going to fix it?

Thanks,

Li

---

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 16, 2008, 1:36am UTC](https://www.ruby-forum.com/t/having-problem-in-printing-out-correct-character/153380/2 "2008-11-16T01:36:19Z")

</div>

> I copy some texts from a pdf file and save them in a text file. I  
> extract some info from the text file, write them to a yaml file. Then I  
> use a script to print out the yaml file. It works OK most of the time.  
> But I am a bit annoyed that sometimes it can mess up with some words,  
> such as “passÃ©”.  
> How am I going to fix it?

I have no idea, and I’ve never dealt with these issues. So I asked  
Google,

[http://groups.google.com/groups/search?hl=en&q=ruby+convert+unicode+ascii](http://groups.google.com/groups/search?hl=en&q=ruby+convert+unicode+ascii)

The first hit answers your question.

---

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 16, 2008, 6:12am UTC](https://www.ruby-forum.com/t/having-problem-in-printing-out-correct-character/153380/3 "2008-11-16T06:12:03Z")

</div>

On Nov 15, 2008, at 6:33 PM, The Higgs bozo wrote:

> Google,
> 
> [http://groups.google.com/groups/search?hl=en&q=ruby+convert+unicode+ascii](http://groups.google.com/groups/search?hl=en&q=ruby+convert+unicode+ascii)
> 
> The first hit answers your question.

You may also wish to browse the series of blog posts I have been  
writing on character encodings:

[http://blog.grayproductions.net/articles/understanding\_m17n](http://blog.grayproductions.net/articles/understanding_m17n)

James Edward G. II
