• Andrew Dunstan's avatar
    Close previously open holes for invalidly encoded data to enter the · 55613bf9
    Andrew Dunstan authored
    database via builtin functions, as recently discussed on -hackers.
    
    chr() now returns a character in the database encoding. For UTF8 encoded databases
    the argument is treated as a Unicode code point. For other multi-byte encodings
    the argument must designate a strict ascii character, or an error is raised,
    as is also the case if the argument is 0.
    
    ascii() is adjusted so that it remains the inverse of chr().
    
    The two argument form of convert() is gone, and the three argument form now
    takes a bytea first argument and returns a bytea. To cover this loss three new
    functions are introduced:
    . convert_from(bytea, name) returns text - converts the first argument from the
      named encoding to the database encoding
    . convert_to(text, name) returns bytea - converts the first argument from the
      database encoding to the named encoding
    . length(bytea, name) returns int - gives the length of the first argument in
      characters in the named encoding
    55613bf9
wchar.c 33.4 KB