normalizeQuote converts Unicode quote characters to standard ASCII quotes. This normalization ensures consistent quote handling across different text encodings and input sources (e.g., copy-paste from documents, web forms). Normalization mappings: - U+2018 (') LEFT SINGLE QUOTATION MARK → ' - U+20
(r rune)
| 100 | // Returns the normalized ASCII quote character, or the original rune if |
| 101 | // it's not a Unicode quote. |
| 102 | func normalizeQuote(r rune) rune { |
| 103 | switch r { |
| 104 | case '\u2018', '\u2019', '\u00AB', '\u00BB': // Single quotes and guillemets |
| 105 | return '\'' |
| 106 | case '\u201C', '\u201D': // Left and right double quotes |
| 107 | return '"' |
| 108 | default: |
| 109 | return r |
| 110 | } |
| 111 | } |
no outgoing calls
no test coverage detected