Changeset 24927 for gs3-extensions

Show
Ignore:
Timestamp:
09.01.2012 16:16:59 (8 years ago)
Author:
davidb
Message:

More careful handling of JSON strings to work correctly with UTF8

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/html-to-expeditee/trunk/src/perllib/cgiactions/HtmlToExpediteeAction.pm

    r24924 r24927  
    4848my $action_table = 
    4949{  
    50     "generate-frame"     => { 'compulsory-args' => [ "json" ], 
     50    "generate-frame"     => { 'compulsory-args' => [ "fn", "json" ], 
    5151                  'optional-args'   => [] },  
    5252}; 
     
    8080    # no need to lock collection (??), the operation is read only 
    8181 
    82     my $json_str = $gsdl_cgi->param("json"); 
    83     # my $exp_frame_tree = decode_json($json_str); 
     82    my $json_str_unicode = $self->{'json'};  
     83    my $json_str_utf8 = Encode::encode("utf8",$json_str_unicode); 
     84    my $exp_frame_tree = decode_json $json_str_utf8; 
    8485     
     86 
    8587    my $output_dir = &util::filename_cat($collect_dir,$collect,"export"); 
    8688 
     
    9193 
    9294    if (open(FOUT,">$frame_filename")) { 
    93      
    94     print FOUT $json_str; 
     95    binmode(FOUT,":utf8"); 
     96 
     97    print FOUT $json_str_utf8; 
    9598    close(FOUT); 
    9699