[aisleriot/gnome-3-10] guile: Set the default port encoding to UTF-8



commit 15d805a47a2caed5f4a3a61b2a0daf099cf111b2
Author: Christian Persch <chpe gnome org>
Date:   Sat Mar 5 20:29:34 2016 +0100

    guile: Set the default port encoding to UTF-8
    
    This is the encoding that strings returned from 'format' are in,
    so since we need all strings to be UTF-8 independently of the locale
    encoding, we need to set this explicitly to UTF-8.
    (Also guile docs say this is picked up from the locale encoding,
    but even though we call setlocale(3), the default port encoding
    isn't set, for whatever reason.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733881
    (cherry picked from commit 3383b6786e9631daab378628a01d6750f11677fe)
    (cherry picked from commit 12db9dc84097308d7a6e21d0b94585528c0e45af)

 games/api.scm |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/games/api.scm b/games/api.scm
index 18bae8f..6e58849 100644
--- a/games/api.scm
+++ b/games/api.scm
@@ -18,6 +18,16 @@
 
 (use-modules (aisleriot interface) (ice-9 format) (ice-9 i18n))
 
+;; This is the encoding of strings returned from e.g. 'format',
+;; so we need to set this to "UTF-8" since that's what the C side
+;; of aisleriot expects.  Otherwise as per docs, guile sets this
+;; from the locale encoding, which would be wrong if the locale is
+;; an not UTF-8 locale, and also it seems that even though we call
+;; setlocale(3), the guile side does not pick this up, for whatever
+;; reason.
+;; Bug #733881.
+(fluid-set! %default-port-encoding "UTF-8")
+
 ;; Feature masks:
 (define-public droppable-feature 1)
 (define-public scores-disabled 2)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]