diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2014-03-14 14:18:42 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2014-03-14 14:18:42 +0000 |
commit | 3d230ea253eb58d2bc2281474993d15680ede827 (patch) | |
tree | f1b001ec0a0a97d7e9f1c90e8ce74224f6d77f27 | |
parent | bf8eb05dbbcca6f749d5a234f5c53ef4d84f004e (diff) | |
download | swig-3d230ea253eb58d2bc2281474993d15680ede827.tar.gz |
Fix Guile li_std_string testcase which requires a UTF-8 locale set
This was failing on Mac OSX and is a further fix to
43c8f2351c90574b02bff07c339e5cd530712f9b to fix #139
-rw-r--r-- | Examples/test-suite/guile/li_std_string_runme.scm | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/Examples/test-suite/guile/li_std_string_runme.scm b/Examples/test-suite/guile/li_std_string_runme.scm index 237caccbe..83fc2b5e7 100644 --- a/Examples/test-suite/guile/li_std_string_runme.scm +++ b/Examples/test-suite/guile/li_std_string_runme.scm @@ -3,7 +3,30 @@ ;; current module. That's enough for such a simple test. (dynamic-call "scm_init_li_std_string_module" (dynamic-link "./libli_std_string")) ; Note: when working with non-ascii strings in guile 2 -; locale must be set explicitly +; Guile doesn't handle non-ascii characters in the default C locale +; The locale must be set explicitly ; The setlocale call below takes care of that -(setlocale LC_ALL "en_US.utf8") +; The locale needs to be a UTF-8 locale to handle the non-ASCII characters +; But they are named differently on different systems so we try a few until one works + +(define (try-set-locale name) +; (display "testing ") +; (display name) +; (display "\n") + (catch #t + (lambda () + (setlocale LC_ALL name) + #t + ) + (lambda (key . parameters) + #f + )) +) + +(if (not (try-set-locale "C.UTF-8")) ; Linux +(if (not (try-set-locale "en_US.utf8")) ; Linux +(if (not (try-set-locale "en_US.UTF-8")) ; Mac OSX +(error "Failed to set any UTF-8 locale") +))) + (load "../schemerunme/li_std_string.scm") |