GnuCash
Contact   Instructions
Bug 797746 - [reports] German umlauts not escaped
Summary: [reports] German umlauts not escaped
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Reports (show other bugs)
Version: 3.902
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: reports
QA Contact: reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-11 09:02 EDT by Jannick
Modified: 2020-06-09 10:30 EDT (History)
7 users (show)

See Also:


Attachments
umlauts as part of report standard texts (10.53 KB, image/jpeg)
2020-05-11 09:02 EDT, Jannick
no flags Details
text in report option dialogue wizard (German locale) (36.16 KB, image/jpeg)
2020-05-11 09:03 EDT, Jannick
no flags Details
Screenshot showing correct rendering of German text on report and options. (581.82 KB, image/png)
2020-05-11 22:45 EDT, John Ralls
no flags Details

Description Jannick 2020-05-11 09:02:22 EDT
Created attachment 373693 [details]
umlauts as part of report standard texts

German locale: Umlauts in standard texts of reports and associated report dialogue wizards (for option setting) are not properly html-escaped, hence not nicely displayed.  However, umlauts as part of account names are nicley displayed.  

Example report: Reports > Experimental > Balance sheet (multicolumn)

See examples in attachments.
Comment 1 Jannick 2020-05-11 09:03:31 EDT
Created attachment 373694 [details]
text in report option dialogue wizard (German locale)
Comment 2 Frank H. Ellenberger 2020-05-11 15:45:26 EDT
It is not the task of the translators, to quote non-ASCII characters. The po files are utf-8 encoded.

IMHO it is the task of the report coders, to use utf-8 save string functions.
Comment 3 John Ralls 2020-05-11 15:52:14 EDT
The problem might be that we're not configuring the GtkWebkitWebView to use the right character set.
Comment 4 Christopher Lam 2020-05-11 21:04:41 EDT
Jralls see the report options screenshot. The dates from/to are also in invalid charset. This would indicate the problem isn't related to webview (or even guile).
Comment 5 John Ralls 2020-05-11 22:45:36 EDT
Created attachment 373695 [details]
Screenshot showing correct rendering of German text on report and options.

Chris,

Indeed. As the attached screenshot shows it works fine on MacOS. Since the strings in question are internal, how might they have gotten transcoded out of UTF-8?

Jannick, what OS/Distro & version are you really using? What are your locale settings?
Comment 6 Christopher Lam 2020-05-11 23:28:32 EDT
The window decorations are also quite old suggesting a version in the early 3.x series. Later 3.x use gtk decorations.
Comment 7 John Ralls 2020-05-11 23:39:45 EDT
> The window decorations are also quite old suggesting a version in the early 3.x series. Later 3.x use gtk decorations.

Nah, that's controlled by the window manager and theme.
Comment 8 Jannick 2020-05-13 04:58:28 EDT
Changing this ticket's OS to 'Windows', as the issue now appears to be Windows specific.  

(In reply to John Ralls from comment #5)
> Jannick, what OS/Distro & version are you really using? What are your locale
> settings?
I am on Windows10 using GC 3.902+(2020-04-27). My locale is German (de), i.e. 'systeminfo' provides:

Systemgebietsschema:                           de;Deutsch (Deutschland)
Eingabegebietsschema:                          de;Deutsch (Deutschland)

(In reply to Christopher Lam from comment #4)
> Jralls see the report options screenshot. The dates from/to are also in
> invalid charset. This would indicate the problem isn't related to webview
> (or even guile).
Not sure if this is true: For the German locale the date format is and should be 'dd.mm.yyyy'. ... or am I missing something here?
Comment 9 John Ralls 2020-05-13 11:48:46 EDT
(In reply to Jannick from comment #8)
> 
> (In reply to Christopher Lam from comment #4)
> > Jralls see the report options screenshot. The dates from/to are also in
> > invalid charset. This would indicate the problem isn't related to webview
> > (or even guile).
> Not sure if this is true: For the German locale the date format is and
> should be 'dd.mm.yyyy'. ... or am I missing something here?

Chris is pointing out that Buchährungsperiode is incorrectly encoded, showing that the problem isn't limited to the html display of reports.
Comment 10 John Ralls 2020-05-13 12:41:42 EDT
(In reply to Christopher Lam from comment #4)
> Jralls see the report options screenshot. The dates from/to are also in
> invalid charset. This would indicate the problem isn't related to webview
> (or even guile).

Maybe. Guile does have a problem with converting strings to utf-8 on Win32, see bug 795037, and the strings originate in date-utils.scm, but those are the English strings. If gettext is called from C to get the values for the options dialog and the report then Guile is clean, but if the gettext calls are from Scheme code then it's down to Guile's defective trasncoding.
Comment 11 Christopher Lam 2020-05-15 07:10:00 EDT
I wonder if the issue is that make-string-database in c-interface.scm is run *before* the monkey-patch in utilities.scm.

To test:

Copy the whole block from utilities.scm to c-interface.scm. Can be located e.g. at the end in c-interface.scm,

---
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; compatibility hack for fixing guile-2.0 string handling. this code
;; may be removed when minimum guile is 2.2 or later. see
;; https://lists.gnu.org/archive/html/guile-user/2019-04/msg00012.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when (string=? (effective-version) "2.0")
  ;; When using Guile 2.0.x, use monkey patching to change the
  ;; behavior of string ports to use UTF-8 as the internal encoding.
  ;; Note that this is the default behavior in Guile 2.2 or later.
  (let* ((mod                     (resolve-module '(guile)))
         (orig-open-input-string  (module-ref mod 'open-input-string))
         (orig-open-output-string (module-ref mod 'open-output-string))
---etc---
Comment 12 John Ralls 2020-05-31 15:19:50 EDT
Assuming Jannick is using the distributed Windows installer, this is Guile 2.2.
Comment 13 John Ralls 2020-06-07 13:59:01 EDT
The problem was that Geert had converted to using guile's gettext module instead of our rather klugy wrapper function as part of moving core-utils guile bindings to bindings/guile. I've put it back, but this time with a three-line change to core-utils.i that tells swig to wrap gettext() and rename it to gnc:gettext.

Unfortunately I didn't get this in time for 3.904, but it will be in 3.905 next weekend and in tomorrow's nightlies.
Comment 14 Jannick 2020-06-08 09:28:42 EDT
gnucash-3.904-2020-06-08-git-3.904-1-gb5aeca94b+.setup.exe: I checked and can confirm that the issue is resolved.

Many thanks!
Comment 15 Geert Janssens 2020-06-09 10:30:39 EDT
(In reply to John Ralls from comment #13)
> The problem was that Geert had converted to using guile's gettext module
> instead of our rather klugy wrapper function as part of moving core-utils
> guile bindings to bindings/guile. I've put it back, but this time with a
> three-line change to core-utils.i that tells swig to wrap gettext() and
> rename it to gnc:gettext.

Interesting, I knew guile was having conversion issues, I just didn't realize they also applied to gettext translations. Sorry for the regression !

Note You need to log in before you can comment on or make changes to this bug.