On Fri, Jan 30, 2009 at 5:56 PM, jicman <cabre...@_wrc.xerox.com> wrote: > Greetings! > > I have done some research on the digitalmars.com for some d code showing UTF8 > to ANSI stuff, and there isn't anything that I can clearly use. > > Long story short, I have about 600+ files that I need to convert from UTF8 to > ANSI. They have different languages characters. I can do open the files > with notepad and save them as ANSI, but, I thought that I would write a quick > d program to do this. > > Can anyone point me out to a site or place where I can quickly create this > small program?
If by "ANSI" you mean the Windows-1252/Latin-1, use std.windows.charset.toMBSz. You can then use std.string.toString to get a char[]. A simple program would look something like: import std.file; import std.windows.charset; import std.string; ... foreach(file; listdir("the_dir")) write("latin_" ~ file, toString(toMBSz(cast(char[])read(file)))); and that will write out a file "latin_<filename>" for each file in the_dir.