You are here: Foswiki>Tasks Web>Item761 (06 Jul 2015, GeorgeClark)Edit Attach

Item761: WYSIWYG break Chinese chars

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Extension
Component: I18N
Branches:
Reported By: ChYang
Waiting For:
Last Change By: GeorgeClark
  • 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 Closed
WaitingFor
Checkins distro:a820f29b54a4
TargetRelease minor
ReleasedIn 1.1.0
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r6 - 06 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy