Bug 435932

Summary: A superscripted number doesn't work in an exponentiation
Product: [Plasma] krunner Reporter: Infine <theinfine>
Component: calculatorAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: nate, plasma-bugs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 5.22

Description Infine 2021-04-19 18:13:34 UTC
SUMMARY


STEPS TO REPRODUCE
1. Make sure the Calculator plugin is enabled in System settings > Search > KRunner.
2. Open KRunner.
3. Copy "10²" into the text field.
4. See the answer.

OBSERVED RESULT
The given answer is 10 '�'.

EXPECTED RESULT
The given answer is 100.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.10.0-6-amd64
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
In the example above 10^2 would work as expected.
Comment 1 Alexander Lohnau 2021-04-19 18:43:49 UTC
Confirmed, but it works as expected in the qalc CLI.
Comment 2 Nate Graham 2021-04-21 19:11:24 UTC
Git commit 6a1bab19af2af22a31fadfd707a5085c4bab11a9 by Nate Graham, on behalf of Alexander Lohnau.
Committed on 21/04/2021 at 19:11.
Pushed by ngraham into branch 'master'.

calculatorrunner: Fix superscripted numbers

Use toLocal8Bit instead of toLatin1 see https://doc.qt.io/qt-5/qstring.html#toLatin1.
Otherwise the superscripted numbers would not be correctly converted.

M  +2    -0    runners/calculator/autotests/calculatorrunnertest.cpp
M  +2    -1    runners/calculator/qalculate_engine.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/6a1bab19af2af22a31fadfd707a5085c4bab11a9