wxTextFile encoding problem Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
richard_examion
Experienced Solver
Experienced Solver
Posts: 69
Joined: Wed Feb 27, 2019 7:17 am

wxTextFile encoding problem

Post by richard_examion »

Hi there,

I am facing a problem with opening and writing into existing *.cpp files:
When I open a .cpp file as a wxTextFile, edit some lines, write and close the file again, the encoding changes from ASCII to UTF-8 (at least GIT tells me so). Is that a problem, if so how can I suppress this behaviour?

Thanks
Richard
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxTextFile encoding problem

Post by doublemax »

wxTextFile::Open() and Write() methods take a "wxMBConv &conv=wxConvAuto()" parameter which is responsible for handling the encoding. Pass "wxConvLocal" there.
Use the source, Luke!
richard_examion
Experienced Solver
Experienced Solver
Posts: 69
Joined: Wed Feb 27, 2019 7:17 am

Re: wxTextFile encoding problem

Post by richard_examion »

Thanks a lot dude, it works fine now!
Post Reply