Tags:
create new tag
view all tags

Question

When I am using my own language script such as Chinese in a topic. I click "Edit" and all Chinese are changed to "&#xxxxx". I don't want that. I want see Chinese words when edit.

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows XP
Web server: Apache 1.3.31
Perl version: 5.6.1
Client OS: Windows XP
Web Browser: IE

-- YiZuo - 12 Jul 2004

Answer

By setting the charset to UTF-8 it worked for my site. I guess it is specifying in your lib/TWiki.cfg either:

  • $siteLocale = "en_US.UTF-8";
  • $siteLocale = "zh_CN.UTF-8";
First one if you want to keep the underlying mechanics english (dates, regexp...). I am afraid the second choice could break things in TWiki engine, but I didn't test.

I even patched TWiki to be able to specify the charset per web, as we only have one web (out of 100) with japanese chars, most other having occasional French ones. To use it, use the attached 2-line patch, and set in the Chinese webs:

  • Set CHARSET = UTF-8

-- ColasNahaboo - 15 Jul 2004

I describe the problem by pictures. Please see the three attachments named "aa1.jpg", "aa2.jpg" and "aa3.jpg". In aa1.jpg: I enter two Chinese words "water" and "fire". aa2.jpg: When I save the page, it is OK. aa3.jpg: But when I click "edit" again, in edit box, the two Chinese words are changed to "&#xxxxx". It is difficult for me to edit the page.

I do change the "siteLocale" variable in Twiki.cfg, it doesn't work.

-- YiZuo - 12 Jul 2004

Colas, the per-web site-locale setting looks like a useful little enhancement. Follow-up in CharsetPerWeb.

-- PeterThoeny - 19 Jul 2004

I have modified Twiki.pm by inserting code provided by Colas. But the problem remains. frown

-- YiZuo - 19 Jul 2004

The problem is solved! Thank Colas. The "CHARSET" environment variable is system environment variable. If you add it into "User environment variable" in Windows XP, it will not work.

-- YiZuo - 19 Jul 2004

Good to see some Chinese language use of TWiki! It may be easier not to use UTF-8 at present, though some people have it working - see JapaneseAndChineseSupport for examples and links.

However, do have a look at InternationalisationEnhancements and in particular ProposedUTF8SupportForI18N before doing anything with UTF-8. While it's possible to get TWiki working with UTF-8, this is not well supported and in particular WikiWords won't work - I did a lot of work on this earlier this year but ran out of time to get this working. It's probably best to use the TWikiBetaRelease as this has some fixes to help with UTF-8.

Also, please note that per-web site locales are a dangerous idea in general, and should only be used as patches for sites that really needs this - what happens if someone renames a topic from one web to another? TWiki code to transcode the character encoding would typically be impossible. It's better to just make UTF-8 work and have one character encoding for all webs.

CHARSET can be defined within the TWiki.cfg, and even overridden specifically if the locale charset doesn't match what the browser supports - see the comments in the beta release.. Setting this within environment variables is not necessary and will be system specific.

-- RichardDonkin - 21 Jul 2004

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch CharsetPerWeb.patch r1 manage 0.5 K 2004-07-15 - 14:19 UnknownUser patch to obey a CHARSET var per web
JPEGjpg aa1.jpg r1 manage 19.0 K 2004-07-18 - 14:02 UnknownUser  
JPEGjpg aa2.jpg r1 manage 5.5 K 2004-07-18 - 14:03 UnknownUser  
JPEGjpg aa3.jpg r1 manage 20.3 K 2004-07-18 - 14:03 UnknownUser  
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2004-09-02 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.