# Noob question string problem

**URL:** <https://www.ruby-forum.com/t/noob-question-string-problem/190286>\
**Category:** Rails\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/noob-question-string-problem/190286 "2010-06-17T16:22:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpuspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@rpuspana](https://www.ruby-forum.com/u/rpuspana)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/noob-question-string-problem/190286/1 "2010-06-17T16:22:41Z")

</div>

Hu there guys,

I hava some problem with the strings, the double-quoted ones.

here is my code :

a = “parsley”

but a[0] returns 112 which is ASCII for ‘o’ not ‘p’  
the same for a[1] a[2] they all return the incorrect ascii code for my  
characters…

is somethig wrong with my ruby or my code??

Thx in advance for all your time and help,  
radu

---

<div class="post-metadata">

**Author:** ![rpuspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@rpuspana](https://www.ruby-forum.com/u/rpuspana)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/noob-question-string-problem/190286/2 "2010-06-17T16:22:49Z")

</div>

On Sat, Jun 12, 2010 at 9:49 AM, rpuspana [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> a = “parsley”
> 
> but a[0] returns 112 which is ASCII for ‘o’ not ‘p’

> is somethig wrong with my ruby or my code??

I think something’s wrong with the ASCII lookup table you’re using 🙂

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![rpuspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/858c86/32.png) [@rpuspana](https://www.ruby-forum.com/u/rpuspana)\
**Post date:** [June 17, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/noob-question-string-problem/190286/3 "2010-06-17T16:27:01Z")

</div>

I’d agree with Hassen here. p is 112 decimal.  
[http://en.wikipedia.org/wiki/Ascii#ASCII\_printable\_characters](http://en.wikipedia.org/wiki/Ascii#ASCII_printable_characters)

[http://en.wikipedia.org/wiki/Ascii#ASCII\_printable\_characters](http://en.wikipedia.org/wiki/Ascii#ASCII_printable_characters)Regards,  
James

On Sun, Jun 13, 2010 at 5:08 AM, Hassan S. \<
