Issue #163 resolved

quote_ident loses encoding

Matt Daw
created an issue

Calling quote_ident on a UTF8 encoded string "shot_sg_assigned_todělá_kdoconnections" produces ASCII encoded string "\"shot_sg_assigned_tod\xC4\x9Bl\xC3\xA1_kdoconnections\"".

I'm modifying the result using force_encoding, which is a reasonable workaround... but it would be nice to have it fixed in the gem.

Comments (7)

  1. Lars Kanis

    I can add this it.

    Connection#quote_ident is the home-brewed version of #escape_identifier which was introduced in postgresql-9.0. So this is duplicated code. Both are almost equally fast in a simple test I just did (quote_ident has a little less overhead for each call but escape_identifier is faster with more than approximately 7 characters) and they do exactly the same. Both don't set the encoding so far. Any thoughts about the future of them? Should we deprecate quote_ident or alias it to escape_identifier or leave it like it is and add a comment only?

  2. Log in to comment