Forum: Ruby HTML entites in ClothRed: yay or nay?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ac0085dae0703db56ad7f8cb9e1798ba?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2007-04-12 14:47
(Received via mailing list)
In preparation of release 0.3.0 (hopefully later today ;), I'm
wondering: Should I translated HTML entities into human-readable format?
My hunch is yes, as that's the point of Textile.

So, I'm at a bit of a loss: I've never, ever worked with character
encodings (I don't even know how to check the encoding on Linux or
Windows).

So, my question is, how do I replace the HTML entities with ISO-8859-1
characters?

The trouble is, that the character encodings don't seem to be taken off
of UTF-8 or something else that I can just escape, or can I?

Meanwhile, I'm digging through the RDoc documentation. Hopefully, I can
find something there.

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #13:

Your first release can always be improved upon.
9a1a4c7f4da6961ef3f6503d7ff33a53?d=identicon&s=25 Adriano Ferreira (Guest)
on 2007-04-12 15:10
(Received via mailing list)
It seems like you need HTMLEntities
(http://htmlentities.rubyforge.org/) which will add a dependency on
your distribution (but better than repeating the same effort others
did).

I think that dependency may be made optional and ClothRed could throw
an exception when asked to decode HTML entities and could not find
that module. I don't know if this is acceptable to you.

From the docs, code like

     require 'htmlentities'
     coder = HTMLEntities.new
     string = "élan"
     coder.decode(string) # => "élan"

take your HTML with entities into UTF-8 characters if I understood
correctly.

Cheers,
Adriano Ferreira.
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-04-12 15:11
(Received via mailing list)
All HTML can be coded in ASCII, as can XML and XHTML
However, that is simply the markup itself.
Do not forgo the encoding.
Convert everything to UTF-8
There is no reason to use anything else.
Visit:
http://www.unicode.org/charts/

http://www.unicode.org/
This topic is locked and can not be replied to.