Bug 406095

Summary: Encoding is broken in speeddial
Product: [Applications] Falkon Reporter: Feufochmar <me>
Component: generalAssignee: David Rosca <nowrep>
Status: RESOLVED FIXED    
Severity: normal CC: Nicky726
Priority: NOR    
Version: 3.1.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Feufochmar 2019-03-31 20:26:32 UTC
SUMMARY
In the thumbnails, if the title or the link contains non-ascii characters, those are not displayed correctly (utf-8 rendered as latin-1) and for links, the link is broken.


STEPS TO REPRODUCE
1. Add for instance http://décodages.com as a favorite shown in speeddial (it has both a link and a title with non-ascii characters)
2. Open speeddial

OBSERVED RESULT
The link is set to https://décodages.com/ and the title is incorrectly rendered. Furthermore, the thumbnail can't be generated because the link is broken.

EXPECTED RESULT
The link should be set to https://décodages.com/ and the title should be displayed correctly.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
If the link is corrected manually from speeddial, the thumbnail and title is loaded and displayed correctly. However, when opening a new speeddial, the link is again broken.
The problem only appeared recently, possibly when I updated falkon to 3.1.0.
Comment 1 Feufochmar 2019-03-31 20:45:34 UTC
I downgraded Falkon to 3.0.1 to check. The problem is not present in 3.0.1.

When using a new, clear, profile in 3.1.0, the problem is also present (so the problem do not comes from an upgrade of the profile from 3.0.1 to 3.1.0).
Comment 2 Nicky726 2019-09-11 16:45:15 UTC
I can confirm this issue.

Moreover, it seems  that there are additional changes to the misinterpreted text, e.g. "bankovnictví" first becomes "bankovnictví" and "bankovnictvÃÂÃÂÃÂÃÂ" after a couple of restarts.
Comment 3 Juraj 2020-02-01 09:37:04 UTC
Git commit 4b7a38680b78397a81099c6994b5182e5a795c3d by Juraj Oravec.
Committed on 01/02/2020 at 09:36.
Pushed by jurajo into branch 'master'.

Speeddial: decode initialScript data as Utf8

Summary:

Solution based on:
https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_4_%E2%80%93_escaping_the_string_before_encoding_it

Test Plan: Add webpage with title which contains Utf8 character (e.g. ľščťžýáíéúäô) into speeddial

Reviewers: #falkon, drosca

Reviewed By: #falkon, drosca

Subscribers: falkon, drosca

Tags: #falkon

Differential Revision: https://phabricator.kde.org/D27081

M  +8    -1    src/lib/data/html/speeddial.user.js

https://commits.kde.org/falkon/4b7a38680b78397a81099c6994b5182e5a795c3d