Project

General

Profile

« Previous | Next » 

Revision 3749

strings.py: concat(): Convert args to raw (non-Unicode) strings first, so that multi-byte Unicode sequences are considered by # of bytes instead of # of chars. This is necessary because PostgreSQL truncates identifiers by # of bytes instead of # of chars, so that identifiers will actually be less than 63 chars long when some chars were multi-byte.

View differences:

strings.py
7 7

  
8 8
##### Parsing
9 9

  
10
def concat(str0, str1, max_len): return str0[:max_len-len(str1)]+str1
10
def concat(str0, str1, max_len):
11
    str0, str1 = map(to_raw_str, [str0, str1])
12
    return to_unicode(str0[:max_len-len(str1)]+str1)
11 13

  
12 14
def split(sep, str_):
13 15
    '''Returns [] if str_ == ""'''

Also available in: Unified diff