Hi,

I am having some problems trygin to pass regular expressions to a webpage encoded in Latin1. I have unsuccessfully tried to convert it to UTF8 before passing the regular expression.

Initially I tried to do something like this:

auto input = readText("myfile.htm");
auto output = replace(input, re1, re2);

But I got this error when trying to run the application:
std.utf.UTFException@C:\DMD2\Windows\bin\..\..\src\phobos\std\utf.d(1113): Invalid UTF-8 sequence (at index 1)

I then tried this, but the error remains

auto input = readText("myfile.htm");
string buffer;
transcode(input, buffer);
auto output = replace(buffer, re1, re2);

Also, this did not work:

auto input = cast(string) read("myfile.htm");
string buffer;
transcode(input, buffer);
auto output = replace(buffer, re1, re2);

core.exception.AssertError@std.encoding(1995): Assertion failure

Please, any help would be appreciated.

Regards, Hugo

Reply via email to