case-folding

Assuming Unicode and case-insensitivity, should the pattern “..” match “FfIsS”?

牧云@^-^@ 提交于 2019-12-04 16:09:32
问题 It sounds like a joke, but I can sort of prove it. Assumptions: Dot matches any single character. A case-insensitive pattern matches s if and only if it matches s.toUpperCase() . All of the following is pretty logical and holds in Java: "ffi".matches(".") LATIN SMALL LIGATURE FFI (U+FB03) is a character, so it must match "ß".matches(".") LATIN SMALL LETTER SHARP S (U+00DF) is a character, so it must match "ffi".toUpperCase().equals("FFI") by the Unicode standard (there's no capital ligature FFI)

How do I make toLowerCase() and toUpperCase() consistent across browsers

心已入冬 提交于 2019-12-01 06:02:58
问题 Are there JavaScript polyfill implementations of String.toLowerCase() and String.toUpperCase(), or other methods in JavaScript that can work with Unicode characters and are consistent across browsers? Background info Performing the following will give difference results in browsers, or even between browser versions (E.g FireFox 54 vs 55): document.write(String.fromCodePoint(223).normalize("NFKC").toLowerCase().toUpperCase().toLowerCase()) In Firefox 55 it gives you ss , in Firefox 54 it gives