Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

rails/postgres error when sending message with special character #4163

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 3 comments
Closed

Comments

@openstreetmap-trac
Copy link

Reporter: woodpeck
[Submitted to the original trac issue database at 3.19pm, Tuesday, 27th December 2011]

I am relaying this message from the German forum:

http://forum.openstreetmap.org/viewtopic.php?pid=210395#p210395

Someone tried to send a message through user-to-user-messaging and got a strange "PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xfc" message. 0xfc is ISO-8859-1 for a common German special character (). I can send messages containing that letter with no problem. I suspect that for some reason if a browser doesn't send UTF-8 but ISO-8859-1 then it breaks. No idea if this is the browser's or server's fault though!

I recommended not using special characters as a workaround.

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 5.10pm, Thursday, 29th December 2011]

This is a tricky area as there is no way to tell what encoding a browser has used for the form data it sends, or to tell it to use a particular encoding.

There are various things you can do to try and persuade the major browsers to send data as UTF-8 but nothing that is 100% guaranteed to work everywhere.

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 5.24pm, Thursday, 29th December 2011]

I think we're probably doing everything we can here to be honest - we (well rails anyway) are setting accept-charset="UTF-8" on the form and adding a hidden field with a UTF-8 encoded value.

Both of those are things which will persuade some browsers to return form data as UTF-8 but obviously not all browsers...

Could you find out what browser the user reporting the problem was using?

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 5.56pm, Saturday, 17th March 2012]

I'm closing this given that's it not clear there is anything we can do, and we have no idea what browser triggered the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant