Skip to content

Commit 7530731

Browse files
committed
Change in uppercase of ß
1 parent b0f5b3a commit 7530731

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

Project.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ keywords = ["Characters"]
44
license = "MIT"
55
desc = "Basic functionality for Chr type"
66
authors = ["ScottPJones <scottjones@alum.mit.edu>"]
7-
version = "0.1.5"
7+
version = "0.1.6"
88

99
[deps]
10-
CharSetEncodings = "cb9422de-a9d8-5b68-86db-ff05833ab307"
11-
ModuleInterfaceTools = "5cb8414e-7aab-5a03-a681-351269c074bf"
1210
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
13-
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
14-
StrAPI = "69e7dfc3-c4d0-5e14-8d95-d6042a05b383"
1511
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
12+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1613
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
14+
15+
ModuleInterfaceTools = "5cb8414e-7aab-5a03-a681-351269c074bf"
16+
17+
StrAPI = "69e7dfc3-c4d0-5e14-8d95-d6042a05b383"
18+
CharSetEncodings = "cb9422de-a9d8-5b68-86db-ff05833ab307"

src/ChrBase.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ using ModuleInterfaceTools
2323
write_utf8, write_utf16, _write_utf8_2, _write_utf8_3, _write_utf8_4, _write_ucs2,
2424
_lowercase_l, _uppercase_l, _lowercase_u, _uppercase_u, _titlecase_u,
2525
_islower_a, _islower_u, _isupper_a, _isupper_l, _isupper_al, _isupper_u,
26-
_can_upper_latin, _can_upper_only_latin, _can_upper_ch, _can_lower_ch,
27-
_can_upper, _can_upper_l
26+
_can_upper_ch, _can_lower_ch, _can_upper, _can_upper_l
2827

2928
@api develop! _isvalid_chr
3029

src/casefold.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,21 @@ uppercase(ch::LatinChr) = LatinChr(_uppercase_l(codepoint(ch)))
2828
function uppercase(ch::_LatinChr)
2929
cb = codepoint(ch)
3030
_can_upper(cb) && return _LatinChr(cb - 0x20)
31-
# We don't uppercase 0xdf, the ß character
32-
cb == 0xb5 ? UCS2Chr(0x39c) : (cb == 0xff ? UCS2Chr(0x178) : ch)
31+
# We didn't used to uppercase 0xdf, the ß character, now we do
32+
!V6_COMPAT && cb == 0xdf && return UCS2Chr(0x1e9e)
33+
cb == 0xb5 ? UCS2Chr(0x39c) : cb == 0xff ? UCS2Chr(0x178) : ch
3334
end
3435
titlecase(ch::LatinChars) = uppercase(ch)
3536

36-
_can_upper_latin(ch) = _can_upper(ch) | (ch == 0xb5) | (ch == 0xff)
37-
_can_upper_only_latin(ch) = _can_upper_l(ch) | (ch == 0xb5) | (ch == 0xff)
37+
@static if V6_COMPAT
38+
@inline _can_upper_ch(ch) =
39+
(ch <= 0x7f
40+
? _islower_a(ch)
41+
: (ch > 0xff ? _islower_u(ch) : ifelse(c > 0xdf, c != 0xf7, c == 0xb5)))
42+
else
43+
@inline _can_upper_ch(ch) =
44+
ch <= 0x7f ? _islower_a(ch) : (ch <= 0xff ? _is_lower_l(ch) : _islower_u(ch))
45+
end
3846

39-
@inline _can_upper_ch(ch) =
40-
ch <= 0x7f ? _islower_a(ch) : (ch <= 0xff ? _can_upper_only_latin(ch) : _islower_u(ch))
4147
@inline _can_lower_ch(ch) =
4248
ch <= 0x7f ? _isupper_a(ch) : (ch <= 0xff ? _isupper_l(ch) : _isupper_u(ch))

0 commit comments

Comments
 (0)