X Tutup
Skip to content

Commit c4823c5

Browse files
author
Johan Brichau
committed
utf8 encoding changes in Pharo9: clean up GRPlatform implementation and make the testLanguageTag make the switch only in Pharo9
1 parent 2bd416b commit c4823c5

File tree

7 files changed

+24
-19
lines changed

7 files changed

+24
-19
lines changed

repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/initialize.st

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
utf8 codec
2+
setutf8CodectoDeprecatedTextConverter
3+
"Set to the GRPharoDeprecatedUtf8Codec that uses the deprecated TextConverter for utf8 encoding"
4+
utf8DeprecatedCodecFlag := true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
utf8 codec
2+
setutf8CodectoZinc
3+
"Set to GRPharoUtf8Codec that uses Zinc for utf8 encoding"
4+
utf8DeprecatedCodecFlag := nil

repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/instance/utf8CodecClass..st

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
private
1+
utf8 codec
22
utf8CodecClass
3-
^ utf8CodecClass
3+
4+
^ utf8DeprecatedCodecFlag
5+
ifNil: [ GRPharoUtf8Codec ]
6+
ifNotNil: [ GRPharoDeprecatedUtf8Codec ]

repository/Grease-Pharo90-Core.package/GRPharoPlatform.class/properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"XmlTable"
1010
],
1111
"instvars" : [
12-
"utf8CodecClass"
12+
"utf8DeprecatedCodecFlag"
1313
],
1414
"name" : "GRPharoPlatform",
1515
"type" : "normal"
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
tests
22
testLanguageTag
3+
34
"this makes sure the encoder doesn't fall on the nose with unicode"
5+
46
"Make Japanese String from unicode. see http://www.unicode.org/charts/PDF/U3040.pdf"
7+
58
| leading hiraA hiraO hiraAO |
6-
GRPlatform current utf8CodecClass: GRPharoDeprecatedUtf8Codec.
9+
SystemVersion current major >= 9 ifTrue: [
10+
GRPlatform current setutf8CodectoDeprecatedTextConverter ].
711
[
812
leading := (Smalltalk classNamed: #JapaneseEnvironment) leadingChar.
9-
hiraA := (Character
10-
leadingChar: leading
11-
code: 12354) greaseString. "HIRAGANA LETTER A"
12-
hiraO := (Character
13-
leadingChar: leading
14-
code: 12362) greaseString. "HIRAGANA LETTER O"
13+
hiraA := (Character leadingChar: leading code: 12354) greaseString. "HIRAGANA LETTER A"
14+
hiraO := (Character leadingChar: leading code: 12362) greaseString. "HIRAGANA LETTER O"
1515
hiraAO := hiraA , hiraO.
1616
self assertEncodingIgnoresLanguageTat: hiraA.
1717
self assertEncodingIgnoresLanguageTat: hiraO.
1818
self assertEncodingIgnoresLanguageTat: hiraAO
19-
] ensure: [ GRPlatform current utf8CodecClass: GRPharoUtf8Codec. ]
19+
] ensure: [
20+
SystemVersion current major >= 9 ifTrue: [
21+
GRPlatform current setutf8CodectoZinc ] ]

0 commit comments

Comments
 (0)
X Tutup