Jump to content

[solved]mysql function doesn't load string correctly


hyomin

Recommended Posts

Hi guys, i was trying to load some korean strings from mariadb like  "소말리아", "중국"
and when it's loaded with dbPoll and look at it with outputChatBox its characters are replaced with question marks ( "소말리아"  -> "????", "중국" -> "??" )
and when it's saved to mariadb, it also displays it as question marks
i tried changing collation and connection collation of mariadb to both utf-8 and euckr(korean charset) but it didn't work 
i would be really gratefull if someone can solve this for me
 
here's the code i used
function loadNations()
	local qh = dbQuery(dbc,"select * from nations")
	local result = dbPoll(qh,-1)

	for i=1,#result do
		nations[i] = {}
		for k,v in pairs(result[i]) do
			nations[i][k] = v
		end
	end
end

 

function saveNations()
	local qh
	for i=1,#nations do
		for k,v in pairs(nations[i]) do
			dbExec(dbc,"update nations set `??`=? where nid=?",k,v,nations[i]["nid"])
		end
	end
end

 

 

edit:

solved, i had to provide charset when using dbConnect

Edited by hyomin
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...