diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-04-28 21:01:17 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-04-28 21:01:17 +0000 |
commit | b1c66f742e5000504ae3050b5b0a6d1726095157 (patch) | |
tree | 651f9891048e896dab162f696f35a990e65f1ca3 | |
parent | 2526c17b6e3db7360ed1a52e9b20a241e1d0970f (diff) |
Re-adding the base utf-8 fixes to trunk
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1119 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | LedgerSMB/Form.pm | 7 | ||||
-rw-r--r-- | LedgerSMB/Locale.pm | 3 | ||||
-rw-r--r-- | LedgerSMB/Sysconfig.pm | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index bb8ec4cb..7dbb0451 100644 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -41,6 +41,9 @@ use Time::Local; use Cwd; use File::Copy; +use charnames ':full'; +use open ':utf8'; + package Form; sub new { @@ -98,7 +101,7 @@ sub new { $self->error( "Access Denied", __line__, __file__ ); } - for ( keys %$self ) { $self->{$_} =~ s/\000//g } + for ( keys %$self ) { $self->{$_} =~ s/\N{NULL}//g } $self; } @@ -138,6 +141,7 @@ sub escape { $str = $self->escape( $str, 1 ) if $1 == 0 && $2 < 44; } + $str = utf8::encode('utf8', $str); $str =~ s/([^a-zA-Z0-9_.-])/sprintf("%%%02x", ord($1))/ge; $str; @@ -150,6 +154,7 @@ sub unescape { $str =~ s/\\$//; $str =~ s/%([0-9a-fA-Z]{2})/pack("c",hex($1))/eg; + $str = utf8::decode('utf8', $str) unless utf8::is_utf8($str); $str =~ s/\r?\n/\n/g; $str; diff --git a/LedgerSMB/Locale.pm b/LedgerSMB/Locale.pm index c89fbef0..6b1c4e66 100644 --- a/LedgerSMB/Locale.pm +++ b/LedgerSMB/Locale.pm @@ -27,7 +27,6 @@ package LedgerSMB::Locale; use base 'Locale::Maketext'; use Locale::Maketext::Lexicon; -use HTML::Entities; use Encode; Locale::Maketext::Lexicon->import( @@ -40,7 +39,7 @@ Locale::Maketext::Lexicon->import( sub text { my ( $self, $text, @params ) = @_; - return encode_entities( $self->maketext( $text, @params ) ); + return $self->maketext( $text, @params ); } ##sub date { diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm index f8e1145f..e2b8c09d 100644 --- a/LedgerSMB/Sysconfig.pm +++ b/LedgerSMB/Sysconfig.pm @@ -8,6 +8,8 @@ use LedgerSMB::Form; use Config::Std; use DBI qw(:sql_types); +binmode STDOUT, ':utf8'; + # For Win32, change $pathsep to ';'; $pathsep = ':'; |