@@ -109,6 +109,12 @@ function uppercase_first(str::MaybeSub{S}) where {C<:LatinCSE,S<:Str{C}}
109109 end
110110end
111111
112+ @static if V6_COMPAT
113+ _wide_lower_latin (ch) = (ch == 0xb5 ) | (ch == 0xff )
114+ else
115+ _wide_lower_latin (ch) = (ch == 0xb5 ) | (ch == 0xff ) | (ch == 0xdf )
116+ end
117+
112118# Special handling for characters that can't map into Latin1
113119function uppercase_first (str:: MaybeSub{S} ) where {C<: _LatinCSE ,S<: Str{C} }
114120 (len = ncodeunits (str)) == 0 && return str
@@ -120,9 +126,9 @@ function uppercase_first(str::MaybeSub{S}) where {C<:_LatinCSE,S<:Str{C}}
120126 set_codeunit! (out8, ch - 0x20 )
121127 len > 1 && unsafe_copyto! (out8, pnt+ 1 , len- 1 )
122128 Str (C, buf)
123- elseif (ch == 0xb5 ) | (ch == 0xff )
129+ elseif _wide_lower_latin (ch)
124130 buf, out = _allocate (UInt16, len)
125- set_codeunit! (out, ifelse (ch == 0xb5 , 0x39c , 0x178 ))
131+ set_codeunit! (out, ifelse (ch == 0xb5 , 0x39c , ifelse (ch == 0xff , 0x178 , 0x1e9e ) ))
126132 # Perform the widen operation on the rest (should be done via SIMD)
127133 @inbounds for i = 2 : len
128134 set_codeunit! (out += 2 , get_codeunit (pnt += 2 )% UInt16)
@@ -152,7 +158,7 @@ function _upper(::Type{C}, beg::Ptr{UInt8}, off, len) where {C<:_LatinCSE}
152158 cur = beg + off
153159 # Need to scan the rest of the string to see if _widenupper needs to be called
154160 while cur < fin
155- ((ch = get_codeunit (cur)) == 0xb5 ) | (ch == 0xff ) && return _widenupper (beg, off, len)
161+ _wide_lower_latin ( get_codeunit (cur)) && return _widenupper (beg, off, len)
156162 cur += 1
157163 end
158164 buf, out = _allocate (UInt8, len)
@@ -189,6 +195,8 @@ function _widenupper(beg::Ptr{UInt8}, off, len)
189195 set_codeunit! (out, 0x39c )
190196 elseif ch == 0xff
191197 set_codeunit! (out, 0x178 )
198+ elseif ! V6_COMPAT && (ch == 0xdf )
199+ set_codeunit! (out, 0x1e9e )
192200 else
193201 set_codeunit! (out, _can_upper (ch) ? ch - 0x20 : ch)
194202 end
@@ -218,7 +226,7 @@ function uppercase(str::MaybeSub{S}) where {C<:_LatinCSE,S<:Str{C}}
218226 fin = beg + len
219227 while pnt < fin
220228 ch = get_codeunit (pnt)
221- ((ch == 0xb5 ) | (ch == 0xff ) ) && return _widenupper (beg, pnt- beg, len)
229+ _wide_lower_latin (ch ) && return _widenupper (beg, pnt- beg, len)
222230 _can_upper (ch) && return _upper (C, beg, pnt- beg, len)
223231 pnt += 1
224232 end
@@ -336,6 +344,8 @@ function _upper(::Type{C}, beg, off, len) where {C<:Union{UCS2_CSEs,UTF32_CSEs}}
336344 set_codeunit! (out, 0x39c )
337345 elseif ch == 0xff
338346 set_codeunit! (out, 0x178 )
347+ elseif ! V6_COMPAT && ch == 0xdf
348+ set_codeunit! (out, 0x1e9e )
339349 end
340350 out += sizeof (CU)
341351 end
0 commit comments