Closed
Bug 79833
Opened 25 years ago
Closed 22 years ago
XML:UTF8 characters are not displayed correctly in Page source
Categories
(Core :: XML, defect, P2)
Core
XML
Tracking
()
RESOLVED
WORKSFORME
Future
People
(Reporter: teruko, Assigned: hjtoi-bugzilla)
References
()
Details
(Keywords: intl)
Attachments
(3 files)
|
3.99 KB,
patch
|
Details | Diff | Splinter Review | |
|
6.09 KB,
patch
|
Details | Diff | Splinter Review | |
|
19.60 KB,
patch
|
Details | Diff | Splinter Review |
This XML page is written in UTF-8, but this does not have encoding declaration.
Japanese characters are displayed correctly, but they are not displayed
correctly in View|Page source.
This may be related to the bug 41981.
Tested 2001-05-08 build.
| Reporter | ||
Comment 1•25 years ago
|
||
Changed QA contact to teruko@netscape.com and added intl keyword.
Keywords: intl
QA Contact: petersen → teruko
| Assignee | ||
Comment 2•25 years ago
|
||
Frank, do you want to have this one? I see you fixed some other intl XML view
source problem earlier...
| Assignee | ||
Updated•25 years ago
|
Priority: -- → P3
Target Milestone: --- → mozilla1.0
| Assignee | ||
Updated•25 years ago
|
| Assignee | ||
Comment 3•25 years ago
|
||
nsBranch+ because this is pretty serious handicap for intl developers. Hoping
the fix would be simple.
Priority: P3 → P2
| Assignee | ||
Comment 4•25 years ago
|
||
This is actually a regression, view source works correctly in NS 6.1.
Status: NEW → ASSIGNED
Keywords: regression
| Assignee | ||
Comment 5•25 years ago
|
||
Argh, this is bizarre! Occasionally things work, but usually they don't. I have
seen working and broken behaviour both with NS 6.1 and the latest trunk builds.
Removing regression keyword.
Keywords: regression
| Assignee | ||
Comment 6•25 years ago
|
||
We have DetectByteOrderMark() that can autodetect some charsets, even if the
encoding information is missing. Downloading the URL we get into that function,
and see the first 4 bytes as: 3C 3F 78 6D. According to
http://www.w3.org/TR/2000/REC-xml-20001006#sec-guessing the encoding information
is required in that case. Without it, the DetectByteOrderMark() function does
not detect the encoding at all.
For normal XML view this happens to work correctly since UTF-8 is the default.
But view source goes through HTML code path, which has a different default.
Since DetectByteOrderMark() was not able to detect the encoding, we are left
with the HTML default which shows the bug.
The weird thing still remains: how does the view source SOMETIMES work correctly?
Teruko, could you provide an additional testcase, which is basically the same as
in URL but that has the encoding explicitly set to UTF-8?
While debugging, I noticed that DetectByteOrderMark() is buggy and slow; I
started fixing it, and will attach what I have done so far.
| Assignee | ||
Comment 7•25 years ago
|
||
| Reporter | ||
Comment 8•25 years ago
|
||
Heikki, I created the test case which you requested in
http://babel/tests/browser/xml/xml-japan/weekly-utf8.xml
View sourch works fine in the page.
| Assignee | ||
Comment 9•25 years ago
|
||
Er, but now the original is gone? I need both, please, maybe named like:
weekly-utf-8.xml - the original
weekly-utf-8-with-encoding.xml - the one with encoding
Also, what kind of program can I use to edit these files? Win2k Notepad displays
the characters as "[]", and Visual C++ 6 as garbage, and saving the file from
either one will change the byte order marks.
| Reporter | ||
Comment 10•25 years ago
|
||
Heikki, I created the test cases as you requested.
http://babel/tests/browser/xml/xml-japan/weekly-utf-8.xml
http://babel/tests/browser/xml/xml-japan/weekly-utf-8-with-encoidng.xml
Comment 11•25 years ago
|
||
The charset of a html page is determined in
/mozilla/content/html/document/src/nsHTMLDocument.cpp, function
StartDocumentLoad(). I tried one testcase in view source, it did go along that
code path. Yes, for html, the default normally is latin1, but user can change
that. If your default is set to UTF8, or if you have some of the charset
autodetector turn on, UTF8 will be detected. That might explained the bizzarre
behavior you experienced.
Hope those infor is helpful. Let me know if you have questions.
| Assignee | ||
Comment 12•25 years ago
|
||
Adding perf keyword as well. DetectByteOrderMark() is called 22 times before the
profile manager comes up, of which 18 times we actually end up in trying to
detect the encoding. The numbers to bring up about:blank are 117 and 83,
respectively. While detecting encoding, the current code first copies the buffer
to a temp variable (usually a memory allocation needed since the buffer is so
big), does a Cut() string operation and some unneeded comparisons etc.
I believe I have now speeded up the encoding detection part quite a bit. There
is no longer any string copying done, and no unneeded comparisons. It could
perhaps be still made a bit faster by relying more on the allowed form and bit
operations.
I'll try to check what Quantify has to say.
Needless to say, I am still trying to track down why things sometimes work
without the encoding and sometimes not.
Btw, Teruko, the encoding sample has different byte order marks from the
original. I finally tried editing with Emacs, and it preserves the byte order
marks so now I can twiddle with my local testcase as well.
I will attach the current patch.
Keywords: perf
| Assignee | ||
Comment 13•25 years ago
|
||
| Assignee | ||
Comment 14•25 years ago
|
||
| Assignee | ||
Comment 15•24 years ago
|
||
Moving. My understanding of the spec is that this could actually be a WONTFIX,
but I really would like to know why things occasionally work. Putting explicit
encoding in the XML declaration is always correct and in the testcase I believe
it is even required per the spec because the first 4 bytes are "3C 3F 78 6D".
Keywords: nsbranch+
Target Milestone: mozilla0.9.4 → mozilla0.9.5
| Assignee | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.5 → mozilla0.9.6
| Assignee | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.6 → mozilla0.9.7
| Assignee | ||
Comment 16•24 years ago
|
||
The perf patch has landed, removing keyword. As to the actual bug, I understand
the testcase was incorrect (always requiring encoding in which case we do the
right thing). The weird thing is when it is not present and things sometimes
work and sometimes they don't work. Minor issue, so moving to future.
Keywords: perf
Target Milestone: mozilla0.9.7 → Future
Comment 17•22 years ago
|
||
This worksforme now that view-source defaults to the charset of the page you
opened it from....
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•