Closed Bug 32206 Opened 24 years ago Closed 24 years ago

charset autodetect gets wrong font lang group

Categories

(Core :: Internationalization, defect, P3)

All
Other
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bobj, Assigned: erik)

References

Details

(Whiteboard: [nsbeta2+])

Bug 30037 turned out to be 2 bugs.  This bug is for the unresolved issue that
is summarized by momoi@netscape.com in his 2000-03-15 23:30 to bug 30037:

   ...
   The original problem reported by hub-san is also very bad.
   Typical JPN users will have set the Auto-Detection on.
   
   1. They set the font size to what they want, e.g. 12 pxls.
   2. Now they go surfing. They get to a site with a meta tag, font is
      in 12 pxls as desired.
   3. But the moment they go to a site without a meta tag, something gets
      reset and thereafter the size of the fonts becomes that set for 
      Western, not for Japanese!
   4. It gets worse. Now they go back to the site with a meta tag where 
      the JPN font control used to work. But they now see that the size
      has been reset to the default size for Western there also!
   5. Now in this state, the only way to change the font size for
      Japanese is by the Western category, until you restart.
   ...


cata@netscape.com noted in his 2000-03-16 17:07 comment to bug 30037:

  Ok. I guess that the problem for the second part of the bug (the autodetect 
  case) resides in the fact that the font-sizing code is called before the 
  autodetector has an answer for the charset.
  ...


And erik@netscape.com noted in his 2000-03-16 20:47 comment to bug 30037:

  Frank, please let me know what you think about the following. Soon after the
  creation of a document object, the presentation context's SetShell method is
  called, passing the presentation shell as the argument. SetShell gets the
  document from the shell, and maps the document's charset to the langgroup.

  However, maybe in the auto-detect case, the charset is being changed in the
  document *after* SetShell has been called. Perhaps the document's
  SetDocumentCharacterSet method is called for that purpose. In that case, we
  need some kind of "listener" (perhaps) that would notify the presentation
  context (or presentation shell) when the charset is changed in the document.

  What would be the preferred way for the document to notify the presentation
  context of a charset change? Is a "listener" or "observer" the preferred
  approach in Gecko?


ftang,
Following on Erik's comments, here's a theory, please comment.
You fixed the "flashing" problem with autodetection by determining if layout
had begun and if not, you just change the charset converter and proceed
instead of reloading.  But the DeviceContext was probably set by our original
guess prior to autodetection, and not reset after a different charset is
autodetected. If the autodetected charset is in a different language group,
then this bug occurs.  Could this be it?
To set the default character set, you should use this pref:

intl.charset.default

I am testing it right now.
Ok, so it looks that by setting that pref to another charset, we will have some 
sort of work-around. The side effects are pretty funky: any unmarked doc (most 
of the latin1) will be considered as being of that default charset. No harm in 
in, though.
Thanks.  Please file a bug to msanz w/keyword "jab1" specifying what
default should be specified in which file for the Japanese beta1. Leave this
bug open and assigned to ftang.
Status: NEW → ASSIGNED
Target Milestone: M16
I change the charset in the parser/scanner from the charset detector adaptor, 
but I didn't change it to the nsIDocument. Also, after the nsPreShell get 
create, it won't listen to the nsIDocument::GetDocumentCharacterSet anymore, we 
need to propogate that. Probabaly we need a listener model ....
Keywords: beta2
>I change the charset in the parser/scanner from the charset detector adaptor, 
but I didn't change it to the nsIDocument.
This statement is wrong. I do remember to set the nsIDocument but I forgot I did 
so last time when I put in the comment. The nsIDocument::SetDocumentCharacterSet 
DO get called. (see 
http://lxr.mozilla.org/seamonkey/source/intl/chardet/src/nsDetectionAdaptor.cpp#
103
 ) Now the problem is the PresShell do not get notify. erik said he is willing 
to take care that part for me so I reassign this to erik.
Assignee: ftang → erik
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Keywords: nsbeta2
Putting on [nsbeta2+] radar for beta2 fix.
Whiteboard: [nsbeta2+]
Target Milestone: M16 → M17
*** Bug 40029 has been marked as a duplicate of this bug. ***
Checked in the fix. We are now observing the charset from nsPresContext.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Target Milestone: M17 → M16
I verified this in 2000-06-19-08 build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.