* Validates that a string doesn't start with BOM. * Note: This is a fallback when only a string is available. * By the time we have a JS string, invalid UTF-8 has already been handled during decoding. * For proper UTF-8 validation, use decodeUtf8NoBom() on raw bytes before decoding. * * @param
(yamlContent: string)
| 42 | * @throws EncodingError if BOM prefix detected |
| 43 | */ |
| 44 | function validateNoBomPrefix(yamlContent: string): void { |
| 45 | // Check for UTF-8 BOM that was decoded as U+FEFF |
| 46 | if (yamlContent.charCodeAt(0) === 0xfeff) { |
| 47 | throw new EncodingError('UTF-8 BOM detected in Deepnote file - files must be UTF-8 without BOM') |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Validates that the YAML document doesn't contain prohibited features: |