allow utf8 characters in CDR details, #28102
authorMark Wells <mark@freeside.biz>
Wed, 12 Mar 2014 21:08:54 +0000 (14:08 -0700)
committerMark Wells <mark@freeside.biz>
Wed, 12 Mar 2014 21:08:54 +0000 (14:08 -0700)
FS/FS/Record.pm
FS/FS/detail_format.pm

index a47cc8b..a684425 100644 (file)
@@ -2497,8 +2497,10 @@ sub ut_text {
   #warn "msgcat ". \&msgcat. "\n";
   #warn "notexist ". \&notexist. "\n";
   #warn "AUTOLOAD ". \&AUTOLOAD. "\n";
+  # \p{Word} = alphanumerics, marks (diacritics), and connectors
+  # see perldoc perluniprops
   $self->getfield($field)
-    =~ /^([\ \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]\<\>$money_char]+)$/
+    =~ /^([\p{Word} \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]\<\>$money_char]+)$/
       or return gettext('illegal_or_empty_text'). " $field: ".
                  $self->getfield($field);
   $self->setfield($field,$1);
@@ -2872,7 +2874,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+//; 
@@ -3332,6 +3334,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;
index 665afdb..2417b3a 100644 (file)
@@ -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),