Project

General

Profile

Actions

Feature #1724

closed

Support for "&*uml;"-HTML-codes in ERB::Util.html_escape (solution included)

Added by vosch (Volkmar Schulz) over 14 years ago. Updated over 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:24140]

Description

=begin
Certain language specific chars like the german "Umlaute" are represented in HTML with "ä" (ä), "ü" (ü) etc.
Since ERB::Util.html_escape escapes the & to become "&" one cannot use these HTML codes.

To work around this problem I modified ERB::Util.html_escape like this:

 def html_escape(s)
   s.to_s.gsub(/&(?!.uml)/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
 end

The modification is in the first call of gsub where I added the condition (?!.uml).
it forces the function to ignore the "&" if it is followed by a pattern that indicates one of the aforementiond HTML-codes.

I consider this being a safe modification.
=end

Actions #1

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Project changed from Backport186 to Ruby master
  • Description updated (diff)
  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0