Ignore:
Timestamp:
2016-02-10T14:53:51+13:00 (8 years ago)
Author:
kjdon
Message:

first stab at fixing diego's bug where you can't add accented values from a select in the depositor. the problem seems to be that argsstr form a get is not unicode, but from a post it is??

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/cgiutils.cpp

    r28888 r30373  
    412412  text_t::const_iterator here = argstr.begin();
    413413  text_t::const_iterator end = argstr.end();
     414  // get seems to be not unicode, while post is, so don't want to just assume encoding is 1 (not unicode)
     415  unsigned short args_encoding = argstr.getencoding();
     416  cerr << "args enc = "<< args_encoding<<endl;
    414417  text_t key, value;
    415418 
     
    425428    safe_cgi_arg(key, value); // mitigate obvious cross-site scripting hacks in URL cgi-params
    426429
    427     value.setencoding(1); // other encoding
     430    value.setencoding(args_encoding); //1 // other encoding
    428431    // store this key=value pair
    429432    if (!key.empty()) {
     
    441444    // If the arg is not multi valued, then you need to decode the commas.
    442445    if (args.getarg(key)==NULL) {
    443       args.setarg (key, encode_commas(value), cgiarg_t::cgi_arg);
     446      // encode_commas returns a text_t without encoding bit set
     447      text_t newvalue = encode_commas(value);
     448      newvalue.setencoding(args_encoding);
     449      args.setarg (key, newvalue, cgiarg_t::cgi_arg);
    444450    }
    445451    else {
     
    447453
    448454      newvalue += "," + encode_commas(value);
    449       newvalue.setencoding(1); // other encoding
     455      newvalue.setencoding(args_encoding); // other encoding
    450456      args.setarg (key, newvalue, cgiarg_t::cgi_arg);
    451457    }
     
    457463      if (args.lookupcgiarg(key).source == cgiarg_t::cgi_arg) newvalue += ",";
    458464      newvalue += encode_commas(value);
    459       newvalue.setencoding(1); // other encoding
     465      newvalue.setencoding(args_encoding); // other encoding
    460466      args.setarg (key, newvalue, cgiarg_t::cgi_arg);
    461467
Note: See TracChangeset for help on using the changeset viewer.