Forum: Ruby Strange rhtml template compile error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
M. A. (Guest)
on 2008-12-15 20:11
I have the following statement inside an rhtml file


These chars are from ISO-8859-9 and their byte values are F0, D0, F0
respectively, which are "LATIN SMALL LETTER G WITH BREVE" and "LATIN

When I run this code it gets:

compile error
C:/test/app/views/test/work.rhtml:1: unterminated string meets end of
C:/test/app/views/test/work.rhtml:1: syntax error, unexpected $end,
expecting ')'

Extracted source (around line #1):

1: <%="���"%>

However when I debug the code using rdebug, I see that the following
in action_view\template_handlers\compileable.rb is called.

file_name, -line_offset)

Here the value of render_source printed by the debugger is as follows:

"def _run_erb_47app47views47test47work46rhtml(local_assigns)\n_erbout =
''; _erb
out.concat((\"­-º­-").to_s); _erbout\nend"
            ^    ^
            |    |---- it does not escape here
            |---- here it escapes " but

The strange thing I noticed is above, where it escapes the first double
quote  but not the second.

I thougt that the debugger may not be interpreting the characters
correctly so checked the byte values by evaluating by hand like
render_source[91], render_source[92], render_source[93]. It gave me
correct values as 240, 208 and 240 again. However, module_eval keeps
giving compilation error although I cannot see and appearant reason why
is fails.

Can someone shed some light on it?

This topic is locked and can not be replied to.