From: pjb@... (Pascal J. Bourguignon) Date: 2009-04-22T05:55:05+09:00 Subject: Re: special characters screwing up string operations Aryk Grosz writes: > Im doing some manipulation of strings, and there are some characters > that Ruby just really does not like: > > “ – > > If you try to paste these into a Ruby console the cursor will jump > around. Likewise, if you put it in a string and try to do text[5,4] it > will give you the wrong piece of the text. > > How do I get around this. Is there some special escape command or do I > just have to gsub these characters? Perhaps you could try a real programming language? C/USER[1]> (length "abcde\“\ \–fgh") 11 C/USER[2]> (subseq "abcde\“\ \–fgh" 5 6) "“" C/USER[3]> (subseq "abcde\“\ \–fgh" 5 9) "“ –f" C/USER[4]> (map 'list (function char-code) "abcde“ –fgh") (97 98 99 100 101 8220 32 8211 102 103 104) -- __Pascal Bourguignon__