Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] [HELP] Invalid string value on MySQL.

 
  • 0 Vote(s) - 0 Average
Pawn [HELP] Invalid string value on MySQL.
Smyle
Offline

Burgershot Member
Posts: 7
Threads: 3
Joined: Jan 2021
Reputation: 0
Location: Brazil
#1
2021-01-16, 12:07 AM
Hey, yall. So i was trying to make some records inside of a MySQL table and i must use special characters (ç, ã, á, é, etc). The issue is that when i try to insert a new row into the table with that special characters these special characters just returns to me this following error:

Code:
Incorrect string value: '\xE7\xE3o de...'

Note: \xE7 matches to 'ç' and \xE3 matches to the 'ã' character.

I've already tried to change my collate and character set on MySQL to utfmb4, utf8, latin1, etc. but nothing works. Also i tried to use mysql_escape_string and also tried to use %e instead of %s when manipulating this string whit the special characters. But nothing seems to change.

Code:
    mysql_format(DBConn, Query, 500, "INSERT INTO %s (Data, Registro) VALUES ('%d', '%s')", tableName, timestamp, msg);
    mysql_query(DBConn, Query);


Note²: When printing the same format i am using to query, everything shows up fine as expected in the console.
Expert*
Offline

Burgershot Member
Posts: 61
Threads: 2
Joined: Apr 2019
Reputation: 4
#2
2021-01-18, 07:46 PM (This post was last modified: 2021-01-18, 07:49 PM by Expert*.)
Try using latin1_general_ci in your database.
Also set mysql_set_charset( "latin1", db_conn ); in your gamemode. ( this function name and syntax might be different, it depends on mysql version that you are using )
RhaegarX
Offline

Burgershot Member
Posts: 66
Threads: 12
Joined: Nov 2020
Reputation: 4
#3
2021-01-22, 03:49 PM
Try using:

PHP Code:
mysql_set_charset("utf8") 
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode