From be0e9e416110d38acdc864a9019bfc47870ee5c2 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 11 Mar 2014 19:10:19 -0700 Subject: [PATCH] allow utf8 characters in CDR details, #28102 --- FS/FS/Record.pm | 8 ++++++-- FS/FS/detail_format.pm | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index e839879c7..88e54115d 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -2366,8 +2366,10 @@ sub ut_text { #warn "msgcat ". \&msgcat. "\n"; #warn "notexist ". \¬exist. "\n"; #warn "AUTOLOAD ". \&AUTOLOAD. "\n"; + # \p{Word} = alphanumerics, marks (diacritics), and connectors + # see perldoc perluniprops $self->getfield($field) - =~ /^([\wô \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]\<\>$money_char]+)$/ + =~ /^([\p{Word} \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]\<\>$money_char]+)$/ or return gettext('illegal_or_empty_text'). " $field: ". $self->getfield($field); $self->setfield($field,$1); @@ -2741,7 +2743,7 @@ May not be null. sub ut_name { my( $self, $field ) = @_; # warn "ut_name allowed alphanumerics: +(sort grep /\w/, map { chr() } 0..255), "\n"; - $self->getfield($field) =~ /^([\w \,\.\-\']+)$/ + $self->getfield($field) =~ /^([\p{Word} \,\.\-\']+)$/ or return gettext('illegal_name'). " $field: ". $self->getfield($field); my $name = $1; $name =~ s/^\s+//; @@ -3206,6 +3208,8 @@ sub _quote { my $column_type = $column_obj->type; my $nullable = $column_obj->null; + utf8::upgrade($value); + warn " $table.$column: $value ($column_type". ( $nullable ? ' NULL' : ' NOT NULL' ). ")\n" if $DEBUG > 2; diff --git a/FS/FS/detail_format.pm b/FS/FS/detail_format.pm index 665afdb7a..2417b3aca 100644 --- a/FS/FS/detail_format.pm +++ b/FS/FS/detail_format.pm @@ -70,7 +70,7 @@ sub new { my $language_name = $locale_info{'name'}; my $self = { conf => FS::Conf->new(locale => $locale), - csv => Text::CSV_XS->new, + csv => Text::CSV_XS->new({ binary => 1 }), inbound => ($opt{'inbound'} ? 1 : 0), buffer => ($opt{'buffer'} || []), _lh => FS::L10N->get_handle($locale), -- 2.11.0