mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 08:40:19 +02:00
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'.
This commit is contained in:
parent
bc03d89fa2
commit
eda0622095
2 changed files with 13 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue