andrewdavey / andrewdavey/cassette

Unicode escape sequence in JavaScript causes error on save of manifest.xml

未關閉
#376 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
531
分支
139
PR 合併指標
30 天內沒有已合併 PR

描述

I've just narrowed this down, and it's Friday evening, so forgive me if I haven't had time to pinpoint the exact issue in the cassette code on my own.

I discovered this issue In bundling/minifying [CodeMirror](http://codemirror.net). File codemirror.js, line 4208:

`if (ch >= "\ud800" && ch < "\udbff" && i < text.length - 1) {`

This can be reproduced as simply as attempting to bundle a javascript file consisting of a single line:

`var test = "\ud800";`

The inner stack trace:

```
[EncoderFallbackException: Unable to translate Unicode character \uD800 at index 10 to specified code page.]
System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) +183
System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars) +293
System.Text.UTF8Encoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, EncoderNLS baseEncoder) +14230776
System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, Boolean flush) +268
System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +101
System.IO.StreamWriter.Write(String value) +147
Cassette.Scripts.<>c__DisplayClass1.b__0() +202
Cassette.AssetBase.OpenStream() +130
Cassette.Caching.BundleCollectionCacheWriter.WriteBundleContentFile(Bundle bundle) +305
Cassette.Caching.BundleCollectionCacheWriter.WriteBundleContentFiles(IEnumerable`1 bundles) +79
Cassette.CacheAwareBundleCollectionInitializer.WriteToCache() +148
Cassette.CacheAwareBundleCollectionInitializer.Initialize(BundleCollection bundleCollection) +274
Cassette.ExceptionCatchingBundleCollectionInitializer.Initialize(BundleCollection bundleCollection) +50
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。