Skip to content

Commit

Permalink
Item13378: global flag Foswiki::UNICODE to indicate unicodeness of th…
Browse files Browse the repository at this point in the history
…e core
  • Loading branch information
Comment committed May 9, 2015
1 parent 3529a20 commit c545e38
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
3 changes: 1 addition & 2 deletions JsonRpcContrib/lib/Foswiki/Contrib/JsonRpcContrib/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ sub toSiteCharSet {
return $string unless $string;

# Convert to unicode if the core supports it
return Encode::decode_utf8($string)
if $Foswiki::USE_UNICODE;
return Encode::decode_utf8($string) if $Foswiki::UNICODE;

return $string
if ( $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8/i );
Expand Down
3 changes: 1 addition & 2 deletions NatEditPlugin/lib/Foswiki/Plugins/NatEditPlugin/RestSave.pm
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ sub toSiteCharSet {
return $string unless $string;

# Convert to unicode if the core supports it
return Encode::decode_utf8($string)
if $Foswiki::USE_UNICODE;
return Encode::decode_utf8($string) if $Foswiki::UNICODE;

return $string
if ( $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8/i );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ our $encoded_nbsp;
# Given a unicode string, decode all entities in it that can be mapped
# to the current site encoding
sub decodeRepresentableEntities {
my $str = shift;

# Expand entities
HTML::Entities::decode_entities($str);
Expand Down
16 changes: 9 additions & 7 deletions WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/Handlers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ our $SECRET_ID =
sub toSiteCharSet {
my $string = shift;

return $string unless $string;
return $string unless defined $string;

# Convert to unicode if the core supports it
return Encode::decode_utf8($string)
if $Foswiki::USE_UNICODE;
return Encode::decode_utf8($string) if $Foswiki::UNICODE;

return $string
if ( $Foswiki::cfg{Site}{CharSet} =~ /^utf-?8/i );
Expand All @@ -54,9 +53,10 @@ sub _OWEBTAG {

return $web unless $query;

if ( defined( $query->param('templatetopic') ) ) {
my $tt = $query->param('templatetopic');
if ( defined($tt) ) {
my @split =
split( /\./, toSiteCharSet( $query->param('templatetopic') ) );
split( /\./, toSiteCharSet($tt) );

if ( $#split == 0 ) {
return $web;
Expand All @@ -76,9 +76,10 @@ sub _OTOPICTAG {

return $topic unless $query;

if ( defined( $query->param('templatetopic') ) ) {
my $tt = $query->param('templatetopic');
if ( defined($tt) ) {
my @split =
split( /\./, toSiteCharSet( $query->param('templatetopic') ) );
split( /\./, toSiteCharSet($tt) );

return $split[$#split];
}
Expand Down Expand Up @@ -668,6 +669,7 @@ sub REST_TML2HTML {
my ( $session, $plugin, $verb, $response ) = @_;

my $tml = Foswiki::Func::getCgiQuery()->param('text');
$tml = toSiteCharSet($tml);

return '' unless $tml;

Expand Down

0 comments on commit c545e38

Please sign in to comment.