Skip to content

Force QString conversion to UTF8 bytes

Todd requested to merge todoooo/paraview:Fix_string_conversion into master

This MR revisits issue https://discourse.paraview.org/t/how-can-i-read-non-ascii-filenames-from-pvpython/3121/15, which demonstrates how Windows 10 can be configured to save/load XML state data with non-ASCII characters by forcing the toLocal8Bit() data conversion to utf8 encoding. The current change set makes that conversion explicit across the code base so that the fix works for all Windows users.

It seems, in the particular case of saving/loading state data, that while it has been possible previously to save non-ASCII characters it has not been possible to load those files again. So it is reasonable to assume that users have only ever stored plain English names/descriptions in their text files (as painful as that might have been for many). However this MR introduces widespread changes and it is therefore uncertain if that assumption is generally true. If not, it would require that users convert their existing text files from their current locale into utf8 in order to successfully reload them.

None of the changes should affect Mac/Linux users where the default encoding format is already utf8.

There are also many places where toLatin() has been used, which I think should also be addressed/eliminated in another MR.

@mwestphal @ben.boeckel Please review.

Edited by Ben Boeckel

Merge request reports