Closed Bug 246700 Opened 21 years ago Closed 21 years ago

nsWyciwygChannel should store BOM for its UTF-16 data

Categories

(SeaMonkey :: General, defect)

Other
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ilya.konstantinov+future, Assigned: jst)

Details

Attachments

(2 files)

nsWyciwygChannel always uses UTF-16 to store its data (which originates from document.writes). It also always answers "UTF-16" to GetCharset. However, it doesn't return a BOM, making it unreliable to detect what kind of UTF-16 it returns. (Mozilla doesn't necessarily use the platform byte ordering for conversion from a charset named "UTF-16".) The solution: On the first WriteToCacheEntry (the time when mCacheOutputStream is created), write a single PUnichar of 0xFEFF (the BOM) to the stream. This will allow Mozilla to recognize the byte ordering this stream was written with.
Attached file Testcase
Click the button to demonstrate the bug.
Attached patch Write out a BOMSplinter Review
Attachment #150886 - Flags: review?(mozilla-bugzilla)
Attachment #150886 - Flags: superreview?(darin)
Comment on attachment 150886 [details] [diff] [review] Write out a BOM seems reasonable to me.
Attachment #150886 - Flags: superreview?(darin) → superreview+
Comment on attachment 150886 [details] [diff] [review] Write out a BOM Looks cool and solves the bug.
Attachment #150886 - Flags: review?(mozilla-bugzilla) → review+
Fixed, thanks for the reviews!
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: