Convert ellipsis to utf-8

M

Markus Fischer

I have a string consisting of 3 periods: "...". I want to convert it
into a single utf-8 character http://www.fileformat.info/info/unicode/char/2026/index.htm

I tried Iconv.iconv('utf-8', 'iso-8859-1', '...') but that didnt
work... any clues?

I think I'd simply go with:

ruby-1.9.2-p0 > puts "foo...bar".gsub!('...', "\u2026")
foo…bar

I wouldn't except iconv() to know how to handle this. I'm not an expert
but I've never seen a conversion creating "multiple characters".
"Multiple bytes", yes, but not "characters".

HTH,
- Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top