Raymond Toy pushed to branch issue-135-unix-namestring-dot at cmucl / cmucl
Commits:
-
e8a0cc6c
by Raymond Toy at 2022-10-30T15:03:27+00:00
-
0dad5a1a
by Raymond Toy at 2022-10-30T15:03:28+00:00
-
1300830b
by Raymond Toy at 2022-10-31T17:12:48+00:00
-
649a4f1e
by Raymond Toy at 2022-10-31T17:12:49+00:00
-
88f6852f
by Raymond Toy at 2022-11-01T12:04:55-07:00
-
d5f1aa5e
by Raymond Toy at 2022-11-01T20:35:49+00:00
-
76f7ea5d
by Raymond Toy at 2022-11-01T14:35:41-07:00
7 changed files:
- src/code/extfmts.lisp
- src/code/intl.lisp
- src/general-info/release-21e.md
- src/pcl/gray-streams.lisp
- + tests/.gitignore
- tests/issues.lisp
- + tests/utf8.txt
Changes:
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | describe-external-format))
|
| 23 | 23 | |
| 24 | 24 | (defvar *default-external-format*
|
| 25 | - :iso8859-1
|
|
| 25 | + :utf-8
|
|
| 26 | 26 | "The default external format to use if no other external format is
|
| 27 | 27 | specified")
|
| 28 | 28 |
| ... | ... | @@ -105,7 +105,7 @@ |
| 105 | 105 | |
| 106 | 106 | (defun find-encoding (domain)
|
| 107 | 107 | (when (null (domain-entry-encoding domain))
|
| 108 | - (setf (domain-entry-encoding domain) :iso-8859-1)
|
|
| 108 | + (setf (domain-entry-encoding domain) :iso8859-1)
|
|
| 109 | 109 | ;; Domain lookup can call the compiler, so set the locale to "C"
|
| 110 | 110 | ;; so things work.
|
| 111 | 111 | (let* ((*locale* "C")
|
| ... | ... | @@ -22,6 +22,7 @@ public domain. |
| 22 | 22 | * Feature enhancements
|
| 23 | 23 | * Changes
|
| 24 | 24 | * Update to ASDF 3.3.6
|
| 25 | + * The default external format is `:utf-8` instead of `:iso8859-1`
|
|
| 25 | 26 | * ANSI compliance fixes:
|
| 26 | 27 | * Bug fixes:
|
| 27 | 28 | * ~~#97~~ Fixes stepping through the source forms in the debugger. This has been broken for quite some time, but it works now.
|
| ... | ... | @@ -50,13 +51,17 @@ public domain. |
| 50 | 51 | * ~~#113~~ REQUIRE on contribs can pull in the wrong things via ASDF.
|
| 51 | 52 | * ~~#121~~ Wrong column index in FILL-POINTER-OUTPUT-STREAM
|
| 52 | 53 | * ~~#122~~ gcc 11 can't build cmucl
|
| 54 | + * ~~#124~~ directory with `:wild-inferiors` doesn't descend subdirectories
|
|
| 53 | 55 | * ~~#125~~ Linux `unix-stat` returning incorrect values
|
| 54 | 56 | * ~~#127~~ Linux unix-getpwuid segfaults when given non-existent uid.
|
| 55 | 57 | * ~~#128~~ `QUIT` accepts an exit code
|
| 58 | + * ~~#130~~ Move file-author to C
|
|
| 56 | 59 | * ~~#132~~ Ansi test `RENAME-FILE.1` no fails
|
| 57 | 60 | * ~~#134~~ Handle the case of `(expt complex complex-rational)`
|
| 58 | 61 | * ~~#136~~ `ensure-directories-exist` should return the given pathspec
|
| 62 | + * #139 `*default-external-format*` defaults to `:utf-8`
|
|
| 59 | 63 | * ~~#142~~ `(random 0)` signals incorrect error
|
| 64 | + * ~~#147~~ `stream-line-column` method missing for `fundamental-character-output-stream`
|
|
| 60 | 65 | * Other changes:
|
| 61 | 66 | * Improvements to the PCL implementation of CLOS:
|
| 62 | 67 | * Changes to building procedure:
|
| ... | ... | @@ -235,6 +235,9 @@ |
| 235 | 235 | defined for this function, although it is permissible for it to
|
| 236 | 236 | always return NIL."))
|
| 237 | 237 | |
| 238 | +(defmethod stream-line-column ((stream fundamental-character-output-stream))
|
|
| 239 | + nil)
|
|
| 240 | + |
|
| 238 | 241 | ;;; Stream-line-length is a CMUCL extension to Gray streams.
|
| 239 | 242 | (defgeneric stream-line-length (stream)
|
| 240 | 243 | (:documentation _N"Return the stream line length or Nil."))
|
| 1 | +/out-utf8.txt |
| ... | ... | @@ -5,6 +5,12 @@ |
| 5 | 5 | |
| 6 | 6 | (in-package "ISSUES-TESTS")
|
| 7 | 7 | |
| 8 | +(defparameter *test-path*
|
|
| 9 | + (merge-pathnames (make-pathname :name :unspecific :type :unspecific
|
|
| 10 | + :version :unspecific)
|
|
| 11 | + *load-truename*)
|
|
| 12 | + "Path to where this file is.")
|
|
| 13 | + |
|
| 8 | 14 | (defun square (x)
|
| 9 | 15 | (expt x 2))
|
| 10 | 16 | |
| ... | ... | @@ -676,7 +682,21 @@ |
| 676 | 682 | ;; work and not return NIL.
|
| 677 | 683 | (assert-true (file-author "."))
|
| 678 | 684 | (assert-true (file-author "bin/build.sh"))
|
| 679 | - (assert-true (file-author "tests/안녕하십니까.txt")))
|
|
| 685 | + (let ((unix::*filename-encoding* :utf-8))
|
|
| 686 | + ;; Set filename encoding to utf-8 so that we can encode the
|
|
| 687 | + ;; filename properly.
|
|
| 688 | + (assert-true
|
|
| 689 | + (file-author
|
|
| 690 | + (merge-pathnames
|
|
| 691 | + (concatenate 'string
|
|
| 692 | + ;; Write the test file name this way so
|
|
| 693 | + ;; that it's independent of the encoding
|
|
| 694 | + ;; used to load this file. The name is
|
|
| 695 | + ;; "안녕하십니까".
|
|
| 696 | + '(#\Hangul_Syllable_An #\Hangul_Syllable_Nyeong #\Hangul_Syllable_Ha
|
|
| 697 | + #\Hangul_Syllable_Sib #\Hangul_Syllable_Ni #\Hangul_Syllable_Gga)
|
|
| 698 | + ".txt")
|
|
| 699 | + *test-path*)))))
|
|
| 680 | 700 | |
| 681 | 701 | (define-test issue.135
|
| 682 | 702 | (:tag :issues)
|
| ... | ... | @@ -704,3 +724,51 @@ |
| 704 | 724 | :type "lisp")
|
| 705 | 725 | (pathname bar))))
|
| 706 | 726 | (assert-true (delete-file "foo.txt"))))
|
| 727 | + |
|
| 728 | +(define-test issue.139-default-external-format
|
|
| 729 | + (:tag :issues)
|
|
| 730 | + (assert-eq :utf-8 stream:*default-external-format*))
|
|
| 731 | + |
|
| 732 | +(define-test issue.139-default-external-format-read-file
|
|
| 733 | + (:tag :issues)
|
|
| 734 | + (let ((string (concatenate 'string
|
|
| 735 | + ;; This is "hello" in Korean
|
|
| 736 | + '(#\Hangul_syllable_an
|
|
| 737 | + #\Hangul_Syllable_Nyeong
|
|
| 738 | + #\Hangul_Syllable_Ha
|
|
| 739 | + #\Hangul_Syllable_Se
|
|
| 740 | + #\Hangul_Syllable_Yo))))
|
|
| 741 | + ;; Test that opening a file for reading uses the the default :utf8
|
|
| 742 | + ;; encoding.
|
|
| 743 | + (with-open-file (s (merge-pathnames "utf8.txt"
|
|
| 744 | + *test-path*)
|
|
| 745 | + :direction :input)
|
|
| 746 | + ;; The first line should be "hello" in Hangul.
|
|
| 747 | + (assert-equal (map 'list #'char-name string)
|
|
| 748 | + (map 'list #'char-name (read-line s))))))
|
|
| 749 | + |
|
| 750 | +(define-test issue.139-default-external-format-write-file
|
|
| 751 | + (:tag :issues)
|
|
| 752 | + ;; Test that opening a file for writing uses the default :utf8.
|
|
| 753 | + ;; First write something out to the file. Then read it back in
|
|
| 754 | + ;; using an explicit format of utf8 and verifying that we got the
|
|
| 755 | + ;; right contents.
|
|
| 756 | + (let ((string (concatenate 'string
|
|
| 757 | + ;; This is "hello" in Korean
|
|
| 758 | + '(#\Hangul_syllable_an
|
|
| 759 | + #\Hangul_Syllable_Nyeong
|
|
| 760 | + #\Hangul_Syllable_Ha
|
|
| 761 | + #\Hangul_Syllable_Se
|
|
| 762 | + #\Hangul_Syllable_Yo))))
|
|
| 763 | + (with-open-file (s (merge-pathnames "out-utf8.txt"
|
|
| 764 | + *test-path*)
|
|
| 765 | + :direction :output
|
|
| 766 | + :if-exists :supersede)
|
|
| 767 | + (write-line string s))
|
|
| 768 | + (with-open-file (s (merge-pathnames "out-utf8.txt"
|
|
| 769 | + *test-path*)
|
|
| 770 | + :direction :input
|
|
| 771 | + :external-format :utf-8)
|
|
| 772 | + (assert-equal (map 'list #'char-name string)
|
|
| 773 | + (map 'list #'char-name (read-line s))))))
|
|
| 774 | + |
| 1 | +안녕하세요
|
|
| 2 | +UTF8 test. The above line is "Hello" in Hangul. |