From: Daniel W. <dm...@lu...> - 2013-02-24 02:52:46
|
diffing dir... Sun Feb 24 02:49:58 GMT 2013 Daniel Wagner <da...@wa...> * Trac #1284: handle characters which require four bytes to encode in UTF8 Ignore-this: baae28f5c5bf5a3b60966ea236f577ec hunk ./glib/System/Glib/UTFString.hs 176 - | otherwise = chr (0xE0 .|. ((ord x `shift` (-12)) .&. 0x0F)): + | ord x<=0xFFFF = chr (0xE0 .|. ((ord x `shift` (-12)) .&. 0x0F)): + chr (0x80 .|. ((ord x `shift` (-6)) .&. 0x3F)): + chr (0x80 .|. (ord x .&. 0x3F)): + toUTF xs + | otherwise = chr (0xF0 .|. ((ord x `shift` (-18)) .&. 0x07)): + chr (0x80 .|. ((ord x `shift` (-12)) .&. 0x3F)): hunk ./glib/System/Glib/UTFString.hs 196 + | ord x<=0xF7 = fourBytes all hunk ./glib/System/Glib/UTFString.hs 206 - threeBytes _ = error "fromUTF: illegal three byte sequence" [_$_] - [_$_] + threeBytes _ = error "fromUTF: illegal three byte sequence" + + fourBytes (x1:x2:x3:x4:xs) = chr (((ord x1 .&. 0x07) `shift` 18) .|. + ((ord x2 .&. 0x3F) `shift` 12) .|. + ((ord x3 .&. 0x3F) `shift` 6) .|. + (ord x4 .&. 0x3F)):fromUTF xs + fourBytes _ = error "fromUTF: illegal four byte sequence" + hunk ./glib/System/Glib/UTFString.hs 228 - | otherwise = n:n:gUO (n+1) xs + | ord x<=0xFFFF = n:n:gUO (n+1) xs + | otherwise = n:n:n:gUO (n+1) xs |