F
Francis Hwang
I asked this a little while back but maybe didn't ask the right way, so
maybe somebody can help me if I rephrase:
I'm trying to build an RSS feed that takes, in its item descriptions,
ISO-8859-1 text. (I'm using REXML for now.) I'd like to be able to take
a non-ASCII character and turn it into a usable XML entity. So, for
example, "\251" would get turned into "©":
str = "\251 2004 Francis Hwang"
elt = REXML::Element.new( 'elt' )
elt.text = str
elt.to_s
=> "<elt>\251 2004 Francis Hwang</elt>"
# But I want "<elt>© 2004 Francis Hwang</elt>"
Is there some sort of setting I can twiddle in REXML so that I can
assign a text that includes these sorts of characters, and REXML will
know to turn them into entities on output? I know I can do this by hand
and then prevent escaping by use the :raw flag, but I'd like to avoid
that if possible.
Francis
maybe somebody can help me if I rephrase:
I'm trying to build an RSS feed that takes, in its item descriptions,
ISO-8859-1 text. (I'm using REXML for now.) I'd like to be able to take
a non-ASCII character and turn it into a usable XML entity. So, for
example, "\251" would get turned into "©":
str = "\251 2004 Francis Hwang"
elt = REXML::Element.new( 'elt' )
elt.text = str
elt.to_s
=> "<elt>\251 2004 Francis Hwang</elt>"
# But I want "<elt>© 2004 Francis Hwang</elt>"
Is there some sort of setting I can twiddle in REXML so that I can
assign a text that includes these sorts of characters, and REXML will
know to turn them into entities on output? I know I can do this by hand
and then prevent escaping by use the :raw flag, but I'd like to avoid
that if possible.
Francis