Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure .owncloudsync.log has the correct encoding #9571

Merged
merged 3 commits into from
Apr 7, 2022

Conversation

TheOneRing
Copy link
Member

No description provided.

@TheOneRing TheOneRing requested a review from a team April 7, 2022 11:44
changelog/unreleased/9571 Outdated Show resolved Hide resolved
src/gui/syncrunfilelog.cpp Outdated Show resolved Hide resolved
src/gui/syncrunfilelog.cpp Show resolved Hide resolved

// we use a text stream to ensure the encoding is ok
// when outputiing info we use QDebug to ensure we can use the debug operatos
_out.reset(new QTextStream(_file.data()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By changing this from QDebug to QTextStream, don't you loose the formatting of standard types (QDateTime) that QDebug has? QDebug also takes an IODevice in the constructor which you could set an encoding before passing it on to QDebug.

For me this is a risky and not not really needed refactoring tbh. We really should not accidentially change any formatting of the file as people might parse it etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats why I still use QDebug in the 3 functions.
I only switched to QDebug 6 month ago, but utf8 never worked on Windows.

Copy link
Contributor

@fmoc fmoc Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QIODevice and subclasses do not provide any kind of encoding feature, only QTextStream provides this. However, a QTextStream is not a QIODevice, and cannot it be wrapped by one (actually, it works the other way round, you can open a QTextStream for a QIODevice).

So, yes, would be nice to have, but it's not possible in Qt at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, yes. Sorry.

TheOneRing and others added 2 commits April 7, 2022 16:45
Co-authored-by: Fabian Müller <80399010+fmoc@users.noreply.github.com>
Co-authored-by: Fabian Müller <80399010+fmoc@users.noreply.github.com>
@TheOneRing TheOneRing merged commit 8b8567c into 2.10 Apr 7, 2022
@delete-merged-branch delete-merged-branch bot deleted the work/owncloudsync_log branch April 7, 2022 15:04
@sonarcloud
Copy link

sonarcloud bot commented Apr 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@gabi18 gabi18 mentioned this pull request Jul 13, 2022
56 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants