Changeset 3217


Ignore:
Timestamp:
2002-07-05T12:13:22+12:00 (22 years ago)
Author:
jrm21
Message:

cgisafe: now properly encodes unicode characters, which is important if we
link to a query on someone's name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/cgiutils.cpp

    r3151 r3217  
    2626#include "cgiutils.h"
    2727#include "gsdlunicode.h"
     28#include "unitool.h" // in mg, for output_utf8_char
    2829
    2930static unsigned short hexdigit (unsigned short c) {
     
    5758
    5859// convert %xx and + to their appropriate equivalents
    59 // IE 6.0 and later use "%u" followed by 4 hex digits...
     60// IE 6.0 and later use "%u" followed by 4 hex digits... MS IIS extension!
    6061void decode_cgi_arg (text_t &argstr) {
    6162  text_t::iterator in = argstr.begin();
     
    221222      // space
    222223      outtext.push_back('+');
     224    } else if (c > 255) { // unicode character
     225      unsigned char buf[3]; // up to 3 bytes
     226      buf[0]='\0';buf[1]='\0';buf[2]='\0';
     227      output_utf8_char(c,buf, buf+2);
     228      outtext.push_back('%');
     229      c2hex(buf[0], ttmp);
     230      outtext += ttmp;
     231      outtext.push_back('%');
     232      c2hex(buf[1], ttmp);
     233      outtext += ttmp;
     234      if (buf[2]) {
     235      outtext.push_back('%');
     236      c2hex(buf[2], ttmp);
     237      outtext += ttmp;
     238      }
    223239    } else {
    224240      // everything else
Note: See TracChangeset for help on using the changeset viewer.