Foswiki on GitHub is open for business! Next release meeting: Monday September 15, 1300Z

Item761: WYSIWYG break Chinese chars

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Waiting for Release Extension I18N  
  • Chinese Editing is well supported in Raw Edit but not WYSIWYG Edit.
  • You can input Chinese chars in the Edit Window, but fail to save. The error you get is
Foswiki detected an internal error - please check your Foswiki logs and webserver logs for more information. Cannot decode string with wide characters 
  • You'll find the following errors in your /foswiki/data/warnXXXXXX.txt
| 10 Jan 2009 - 08:45 | UTF-8 not yet supported as site charset -Foswiki is likely to have problems 
| 10 Jan 2009 - 08:47 | Cannot decode string with wide characters at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Encode.pm line 166. 
  • You can Edit in WYSIWYG editor, but turn to TWiki Raw Edit and save it.

Solution

Edit foswiki/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML.pm:
113c113,116
<         $text = Encode::decode_utf8($text);
---
> #       $text = Encode::decode_utf8($text);
>         if (utf8::valid($text)) {
>             utf8::decode($text);
>         }

IIRC I tried this when I was working on utf8 before, and while it fixes Chinese, it breaks other non-utf8 character sets such as Cyrillic. Fixes for character sets unfortunately have to work for all character sets, at least until we have switched to utf8 everywhere.

This needs to be considered by the WysiwygTaskTeam and the (as yet unnamed) task team that does utf8.

-- CrawfordCurrie - 24 Jan 2009

Related:

-- PaulHarvey - 24 Jan 2010

Fixed on trunk. For example, see http://trunk.foswiki.org/Sandbox/TestTopic44464.

-- MichaelTempest - 20 Jun 2010

ItemTemplate edit

Summary WYSIWYG break Chinese chars
ReportedBy ChYang
Codebase 1.0.9, 1.0.0, trunk
SVN Range SVN 1973: Foswiki-1.0.0, Fri, 09 Jan 2009, build 1899
AppliesTo Extension
Component I18N
Priority Normal
CurrentState Waiting for Release
WaitingFor
Checkins Foswikirev:7854
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r5 - 20 Jun 2010, MichaelTempest
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License