From: takashikkbn@...
Date: 2017-11-10T14:18:06+00:00
Subject: [ruby-core:83733] [Ruby trunk Bug#14095] erb ignores attempt to set	encoding

Issue #14095 has been updated by k0kubun (Takashi Kokubun).


Ah, one more comment is that you can use magic comment to change source file encoding of erb template before and after that change:

~~~ erb
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
$ cat ascii.erb
<%= ''.encoding %>
$ erb -T 1 ascii.erb
ASCII-8BIT
$ cat utf-8.erb
<%# coding: UTF-8 %>
<%= ''.encoding %>
$ erb -T 1 utf-8.erb
UTF-8
~~~

----------------------------------------
Bug #14095: erb ignores attempt to set encoding
https://bugs.ruby-lang.org/issues/14095#change-67770

* Author: graywolf (Gray Wolf)
* Status: Closed
* Priority: Normal
* Assignee: k0kubun (Takashi Kokubun)
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Erb seems to ignore any attempt to set encoding:

    $ erb -U
    <%= "a".encoding %>
    ^D
    ASCII-8BIT

I've tried multiple ways to do this but I just can't convice it that the .erb file is in UTF-8. It insists on ASCII-8BIT.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>