user327712
user327712

Reputation: 3321

Dont know how to select a few records from a table as utf8

I don't have phpMyAdmin installed in my web site.

Sometimes I was doing some select SQL command at the backend,
but when I typed in this command to show all records from table Users:

select * from Users;


The records were printed as ???? | ??? ??? ??? |.

I don't want to make any permanent changes to the charset in the database,
so, how is it possible to temporarily displayed a few records as utf8 when needed?

Upvotes: 1

Views: 110

Answers (3)

Nasser Hadjloo
Nasser Hadjloo

Reputation: 12610

Just put 'N' before your queries like

 select * from User where id = N'یونیکد'

Upvotes: 1

OM The Eternity
OM The Eternity

Reputation: 16204

> CONVERT()

provides a way to convert data between different character sets

example:

SELECT CONVERT(newvalue USING utf8);

Upvotes: 1

oezi
oezi

Reputation: 51797

take a look at the mysql CONVERT-statement, i think thats what you are looking for. if i remember right, the syntax is like this:

SELECT CONVERT(username USING utf8) FROM users...;

Upvotes: 0

Related Questions