diff options
author | Ludovic Courtès <ludo@gnu.org> | 2011-01-24 21:44:44 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2011-01-24 21:44:44 +0100 |
commit | eda06220952cc93e35711ede68ec800144aaf288 (patch) | |
tree | 86f4342aa4ae248bae91a389ba4d0bc193973076 /module/system/base/compile.scm | |
parent | bc03d89fa20f3a84743be87a6ad8fb5b08701c93 (diff) | |
download | guile-eda06220952cc93e35711ede68ec800144aaf288.tar.gz |
Choose the input source file encoding in a locale-independent way.
This is so that compiling the same code on environments with different
locale settings yields the same result.
* module/system/base/compile.scm (compile-file): When ENC if #f, default
to "UTF-8" instead of `(fluid-ref %default-port-encoding)'.
* doc/ref/api-evaluation.texi (Compilation): Document the default output
file name and default source file encoding for `compile-file' and
`guile-tools compile'.
Diffstat (limited to 'module/system/base/compile.scm')
-rw-r--r-- | module/system/base/compile.scm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm index 7c83fd7f5..35dc0b197 100644 --- a/module/system/base/compile.scm +++ b/module/system/base/compile.scm @@ -1,6 +1,6 @@ ;;; High-level compiler interface -;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc. ;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public @@ -120,8 +120,9 @@ (let* ((comp (or output-file (compiled-file-name file))) (in (open-input-file file)) (enc (file-encoding in))) - (if enc - (set-port-encoding! in enc)) + ;; Choose the input encoding deterministically. + (set-port-encoding! in (or enc "UTF-8")) + (ensure-writable-dir (dirname comp)) (call-with-output-file/atomic comp (lambda (port) |