Parsing D files with non-unicode characters

Roland Hadinger rolandh.dlangforum at maildrop.cc
Tue Nov 6 09:40:40 UTC 2018


On Tuesday, 6 November 2018 at 07:25:09 UTC, Bastiaan Veelo wrote:
>
> I may be missing something, but isn’t it possible to open these 
> files one for one in their current encoding and save them in 
> UTF-8 encoding using an editor that supports that, e.g., 
> Sublime Text or Kate?

Yes. Better text editors are capable of automatically inferring 
(guess) the source encoding, although not always correctly. 
Guessing the source encoding is something 'iconv' cannot do.

I forgot to mention that 'iconv' can also convert text between 
different encodings, but only when the source encoding is known. 
When it isn't known or when a file contains a mix of different 
encodings, iconv can only be used to filter out byte sequences 
that are invalid in the target encoding.



More information about the Digitalmars-d mailing list