Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Letters with accent marks (http://www.velocityreviews.com/forums/t845825-letters-with-accent-marks.html)

Hickman Hickman 11-17-2007 12:58 AM

Letters with accent marks
 
Any ideas?

I have a textBox that users will be entering data into and most likely
they will not bother to write the accent marks over the correct letters.
When performing the search I need a way to look at the words in the
database and say does it have a accent mark over it and if so ignore it
and render it as a, e, i, o, u. I tried to copy and paste these letters
with accent marks into the file but the program doesnt recognize them.

Any idea how to test for i with an accent mark, a with an accent mark,
etc...
--
Posted via http://www.ruby-forum.com/.


Jano Svitok 11-17-2007 09:58 AM

Re: Letters with accent marks
 
On Nov 17, 2007 1:58 AM, Hickman Hickman <hickmanchris@msn.com> wrote:
> Any ideas?
>
> I have a textBox that users will be entering data into and most likely
> they will not bother to write the accent marks over the correct letters.
> When performing the search I need a way to look at the words in the
> database and say does it have a accent mark over it and if so ignore it
> and render it as a, e, i, o, u. I tried to copy and paste these letters
> with accent marks into the file but the program doesnt recognize them.
>
> Any idea how to test for i with an accent mark, a with an accent mark,
> etc...


I guess Iconv library is able to convert any encoding to plain ascii.

http://www.ruby-doc.org/stdlib/libdo...doc/index.html

you can try it online at http://www.iconv.com/iconv.htm


Devi Web Development 11-18-2007 04:24 AM

Re: Letters with accent marks
 
On Nov 16, 2007 6:58 PM, Hickman Hickman <hickmanchris@msn.com> wrote:
> Any ideas?
>
> I have a textBox that users will be entering data into and most likely
> they will not bother to write the accent marks over the correct letters.
> When performing the search I need a way to look at the words in the
> database and say does it have a accent mark over it and if so ignore it
> and render it as a, e, i, o, u. I tried to copy and paste these letters
> with accent marks into the file but the program doesn't recognize them.
>
> Any idea how to test for i with an accent mark, a with an accent mark,
> etc...


If it's an issue with your text editor, you can put the escaped octal
version in.
For example, if you want to remove all acute accents, try this
str.gsub! "\303\241",'a'
str.gsub! "\303\251",'e'
str.gsub! "\303\255",'i'
str.gsub! "\303\263",'o'
str.gsub! "\303\272",'u'

-Daniel Brumbaugh Keeney



All times are GMT. The time now is 11:05 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57