National encodings support enhancement

Issue #161 resolved
Former user created an issue

Adds new engine parameter (client_encoding) and makes all strings coming to/from client from/to server to be converted using this encoding.

Also adds automatic convertion to Unicode column types if "client_encoding" is specified

Comments (5)

  1. Former user Account Deleted

    It seems to me that there is an error in encodings.diff. Function convert_result_value is receiving strings from database, not from client, so it shouldn't convert values like this:

    20  +                return unicode(value, engine.client_encoding).encode(engine.encoding)
    

    but like this:

    20  +                return unicode(value, engine.encoding).encode(engine.client_encoding)
    

    You could also consider avoiding conversion if engine.encoding == engine.client_encoding like this:

    10  +            if engine.client_encoding and engine.client_encoding!=engine.encoding and isinstance(value, str):
    19  +            if engine.client_encoding and engine.client_encoding!=engine.encoding and isinstance(value, str):
    
  2. Former user Account Deleted

    (original author: redvasily) Thank you, Qvx

    You are right. Here's a corrected diff

  3. Mike Bayer repo owner

    this ones a little over my head, being an american and all, but there was some continued debate over the appropriateness of this one. since i am not thrilled about building extra conditionals into all string types by default, might want to see this implemented as an optional extension. going to mark as 'wontfix' for now.

  4. Log in to comment