downs Wrote: > downs wrote: > > jicman wrote: > >> Greetings. > >> > >> Sorry guys, please be patient with me. I am having a hard time > >> understanding this Unicode, ANSI, UTF* ideas. I know how to get an UTF8 > >> File and turn it into ANSI. and I know how to take a ANSI file and turn it > >> into an UTF file. But, now I have a Unicode file and I need to change the > >> content and create a new Unicode file with the changes in the content. I > >> have read all kind of places, and I found mtext, from Chris Miller's site, > >> by reading, > >> > >> http://www.prowiki.org/wiki4d/wiki.cgi?DanielKeep/TextInD > >> > >> Anyway, what I need is to read an Unicode file, search the strings inside, > >> make changes to the file and write the changes back to an Unicode file. > >> > >> Any help would be greatly appreciate. > >> > >> thanks, > >> > >> josé > > > > Wow, you're in luck! > > > > D is all unicode. > > > > Just do import std.file; auto text = cast(string) filename.read(); do your > > changes; filename.write(cast(void[]) text); > > > > and you're done. > > PS: You may need to do detection for UTF-16. In that case, just cast to a > wstring instead, then (optionally) use std.utf.toUTF8.
shouldn't auto take care of that?