regarding Latin1 to UTF8 encoding

Adam D. Ruppe destructionator at gmail.com
Sun Dec 8 18:44:19 PST 2013


On Monday, 9 December 2013 at 02:40:29 UTC, Hugo Florentino wrote:
> auto input = readText("myfile.htm");

Don't use readText if it isn't utf-8; readtext assumes it is utf 
8.

I've never actually used std.encoding (I wrote my own encoding 
module for my dom.d, which I used for website scraping too) but I 
think this is what you want:

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


see if that works


More information about the Digitalmars-d-learn mailing list