<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 18 April 2018 at 22:57, John Doe <span dir="ltr"><<a href="mailto:donpedrothird@gmail.com" target="_blank">donpedrothird@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class="gmail-m_-7557438660641263132gmail-bold_code gmail-m_-7557438660641263132gmail-bc-2"><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">> S = <<"fml.ölm vcrd rd hb kh ouniun">>.                           </span></span></span></div></blockquote><div></div></div><br><br></div><div class="gmail_extra">It seems to work properly when one declares the proper encoding of the string literal, e.g.:<br><br>   <<"fml.ölm vcrd rd hb kh ouniun"/utf8>><br><br></div><div class="gmail_extra">In any case, the error is reproducible with the non-compiled regex if  you pass 'unicode' option when calling :replace.<br><br>   re:replace(S, <<>>, <<>>,  [unicode, global, {return, binary}])<br><br></div><div class="gmail_extra">That is: the non-compiled call wasn't interpreting the input as UTF8. Which is why it worked.<br></div></div>