KCM: Make sure Unicode is used for editing bashrc (fixes issue #6)
#7
Merged
blu.256
merged 1 commits from fix/issue-6
into master
3 years ago
Loading…
Reference in New Issue
There is no content yet.
Delete Branch 'fix/issue-6'
Deleting a branch is permanent. It CANNOT be undone. Continue?
This is a proposed fix for issue 6.
This resolves issue #6.
Please do the test using locales encoding.
See comment.
@ -511,2 +511,3 @@
file.open(IO_ReadOnly);
TQByteArray fileData = file.readAll();
TQTextStream fileDataStream = TQTextStream(&file);
fileDataStream.setEncoding(TQTextStream::UnicodeUTF8);
The use of stream encoding is a good choice, but I believe that the locale encoding should be used:
TQTextStream::Locale
. It is likely that the UTF8 encoding will be currently used for most languages, but there may be exceptions.I based this off some code I found in BasKet, so maybe this should be fixed in other places as well.
Good point.
51384f5743
toa7d117f83a
3 years agoAfter testing
TQTextStream::Locale
works as expected.@ -518,3 +519,3 @@
file.open(IO_WriteOnly);
stream.setDevice(TQT_TQIODEVICE(&file));
One more idea: Encoding should also be set when writing data back to file?
I don't know; right now it works well. Maybe encoding should only be set when reading from stream?
According to the TQt docs,
so if I understood that well, it sets the appropriate encoding automatically for the output.
Ok, thank you, in this case it should probably be fine.
It looks fine.
Thank you for fast fix!
Merging and backporting.
No squash needed.
a7d117f83a
into master 3 years agoProblem – I didn't make building before, but now, after merge, and FTBFS occurs:
@ -510,3 +510,3 @@
{
file.open(IO_ReadOnly);
TQByteArray fileData = file.readAll();
TQTextStream fileDataStream = TQTextStream(&file);
Now I found that there is already
TQTextStream stream(&file);
forfile
defined above. So you can use the previousstream
variable. Instead of a newfileDataStream
.I'll do a test if it also solves the FTBFS, which I watch now.
I just checked with the following changes:
Builds and works as expected.
For me build was successful only on Debian 12 (Bookworm), Ubuntu 21.10 (Impish) and Ubuntu 22.04 (Jammy). With an update in #8 build is successfull also on Debian 9 (Stretch).
Strange, it builds fine on Slackware.
Reviewers
a7d117f83a
.