(text: string)
| 161 | }; |
| 162 | |
| 163 | const hasSuspiciousDecodedControlChars = (text: string): boolean => { |
| 164 | let controls = 0; |
| 165 | for (let i = 0; i < text.length; i++) { |
| 166 | const code = text.charCodeAt(i); |
| 167 | if (code === 0xfffd || code === 0) return true; |
| 168 | if (code < 0x20 && code !== 0x09 && code !== 0x0a && code !== 0x0d) { |
| 169 | controls++; |
| 170 | } |
| 171 | } |
| 172 | return controls > Math.max(4, text.length * 0.02); |
| 173 | }; |
| 174 | |
| 175 | /** |
| 176 | * Legacy chardet fallback for readBlobContent. |
no outgoing calls
no test coverage detected