lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


PA wrote:
The correction is fairly obvious. :)

I added an additional string.gsub( aString, "&", "&" ) before decoding the other entities. Is it what you had in mind?

Well... no. :)

I meant that this:
                aString = string.gsub( aString, "&lt;", "<" )
                aString = string.gsub( aString, "&gt;", ">" )
                aString = string.gsub( aString, "&amp;", "&" )
                aString = string.gsub( aString, "&apos;", "'" )
                aString = string.gsub( aString, "&quot;", "\"" )
Should become this:
                aString = string.gsub( aString, "&lt;", "<" )
                aString = string.gsub( aString, "&gt;", ">" )
                aString = string.gsub( aString, "&apos;", "'" )
                aString = string.gsub( aString, "&quot;", "\"" )
                aString = string.gsub( aString, "&amp;", "&" )

Actually I just noticed that you have a similar problem with
&#XXX; entities which can't be solved with merely re-ordering
the substitutions.  But you can fold every &*; case into the
aFunction and be happy (likely somewhat faster too).

--Adam
--
Adam D. Moss   -   adam@gimp.org