Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Adam D. Ruppe
On Monday, 9 December 2013 at 03:33:46 UTC, Hugo Florentino wrote: Coud this work using scope instead of try/catch? Maybe, but I don't think it would be very pretty. Really, I think validate should return a bool instead of throwing, but since it doesn't the try/catch is as close as it gets.

Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Hugo Florentino
On Mon, 09 Dec 2013 04:19:51 +0100, Adam D. Ruppe wrote: On Monday, 9 December 2013 at 03:07:58 UTC, Hugo Florentino wrote: Is there a way to detect the encoding prior to typecasting/loading the file? UTF-8 can be detected fairly reliably, but not much luck for other encodings. A Windows-1258

Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Adam D. Ruppe
On Monday, 9 December 2013 at 03:07:58 UTC, Hugo Florentino wrote: Is there a way to detect the encoding prior to typecasting/loading the file? UTF-8 can be detected fairly reliably, but not much luck for other encodings. A Windows-1258 and a Latin1 file, for example, are usually fairly indis

Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Hugo Florentino
On Mon, 09 Dec 2013 03:44:19 +0100, Adam D. Ruppe wrote: 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 m

Re: regarding Latin1 to UTF8 encoding

2013-12-08 Thread Adam D. Ruppe
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 t

regarding Latin1 to UTF8 encoding

2013-12-08 Thread Hugo Florentino
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(in