I am using gammu-smsd on ubuntu 12.04 as my sms-gateway. It scans information from my modem and inserts it into a postgresql database. Apparently, it tried inserting something into the inbox with invalid characters according to /var/log/syslog:
Oct 28 16:22:15 porkypig gammu-smsd[14936]: SQL failed: INSERT INTO inbox (ReceivingDateTime, Text, SenderNumber, Coding, SMSCNumber, UDH, Class, TextDecoded, RecipientID) VALUES ('2013-10-24 20:03:19', 'D83DDC4D','+13053057707','Unicode_No_Compression','+14044550007','','-1','<d83d><dc4d>','')
Oct 28 16:22:15 porkypig gammu-smsd[14936]: Error: ERROR: invalid byte sequence for encoding "UTF8": 0xeda0bd#012HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
Oct 28 16:22:15 porkypig gammu-smsd[14936]: Query failed, checking connection
Now when I try to start the gammu-smsd server:
sudo /etc/init.d/gammu-smsd start
it crashes with the same output in the syslog as I showed above.
What can I do to fix this?
Postgres already told you what you can do to fix this:
invalid byte sequence for encoding "UTF8": 0xeda0bd#012
"Your client (
gammu-smsd
in this case) send me gibberish. I don't speak gibberish, I speak utf-8."This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
"Tell me what encoding your client is using, either by setting the encoding of the database (which would require dropping & re-creating it), or by having your client set
client_encoding
appropriately."If you don't know what encoding
gammu-smsd
is trying to use, re-create the database with theSQL_ASCII encoding
which basically tells Postgres not to care about what you're passing it.This is a cop-out, but it's a quick solution.
The actual problem here is that gammu-smsd is trying to send UTF-16 to the UTF-8 database:
It should be sending:
(see also http://www.fileformat.info/info/unicode/char/1F44D/index.htm)