Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quote_ident loses encoding #163

Closed
ged opened this issue Jun 3, 2013 · 5 comments
Closed

quote_ident loses encoding #163

ged opened this issue Jun 3, 2013 · 5 comments

Comments

@ged
Copy link
Owner

ged commented Jun 3, 2013

Original report by Matt Daw (Bitbucket: mattdaw, GitHub: mattdaw).


Calling quote_ident on a UTF8 encoded string "shot_sg_assigned_to___dělá_kdo___connections" produces ASCII encoded string ""shot_sg_assigned_to___d\xC4\x9Bl\xC3\xA1_kdo___connections"".

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.

@ged
Copy link
Owner Author

ged commented Jun 3, 2013

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Thanks for reporting this. This should be a pretty small fix, so we'll likely wrap it up into the next release.

@ged
Copy link
Owner Author

ged commented Jun 3, 2013

Original comment by Matt Daw (Bitbucket: mattdaw, GitHub: mattdaw).


Great, thanks!

Matt

@ged
Copy link
Owner Author

ged commented Jun 11, 2013

Original comment by Lars Kanis (Bitbucket: larskanis, GitHub: larskanis).


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?

@ged
Copy link
Owner Author

ged commented Jun 13, 2013

Original comment by Lars Kanis (Bitbucket: larskanis, GitHub: larskanis).


Should be fixed with 72acd792 .

@ged ged closed this as completed Jun 13, 2013
@ged
Copy link
Owner Author

ged commented Jul 3, 2013

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Set proper encoding on the string returned by quote_ident,

From 72acd792eb92004655226fd31307dc821109f2e2 Mon Sep 17 00:00:00 2001
escape_literal and escape_identifier.
This fixes issue #163 : #163 .

@ged ged added this to the Pending milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant