phoenix_expug icon indicating copy to clipboard operation
phoenix_expug copied to clipboard

Can't use international characters in attribute values

Open edjroot opened this issue 5 years ago • 1 comments

Hello!

I'm trying to use Expug on Phoenix 1.4.10, Elixir 1.9.0, Erlang 22.

When I create a page that contains an element with an attribute whose value has some accented character, e.g. button(title="helló") world ('ó' in this case), I get this error:

Compiling 1 file (.ex)

== Compilation error in file lib/hello_web/views/page_view.ex ==
** (UnicodeConversionError) invalid encoding starting at <<195, 34, 41, 41, 32, 37, 62, 62, 60, 37, 61, 32, 34, 92, 110, 34, 32, 37, 62, 104, 101, 108, 108, 111, 60, 37, 61, 32, 34, 92, 110, 34, 32, 37, 62, 60, 47, 112, 62, 10>>
    (elixir) lib/string.ex:2180: String.to_charlist/1
    (eex) lib/eex/tokenizer.ex:33: EEx.Tokenizer.tokenize/3
    (eex) lib/eex/compiler.ex:18: EEx.Compiler.compile/2
    (phoenix) lib/phoenix/template.ex:354: Phoenix.Template.compile/3
    (phoenix) lib/phoenix/template.ex:165: anonymous fn/4 in Phoenix.Template."MACRO-__before_compile__"/2
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix) expanding macro: Phoenix.Template.__before_compile__/1
    lib/hello_web/views/page_view.ex:1: HelloWeb.PageView (module)
    (elixir) lib/kernel/parallel_compiler.ex:229: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

How can I get this to work?

Thanks in advance!

edjroot avatar Sep 17 '19 07:09 edjroot