List:General Discussion« Previous MessageNext Message »
From:fsb Date:January 18 2010 9:05pm
Subject:Re: Regarding storing non-english chars in mysql
View as plain text  
you can specify the character encoding (called CHARSET in mysql) and
collation on a per column, per table or per database level. e.g.

CREATE DATABASE foo CHARACTER SET utf8 COLLATE utf8_general_ci;

or

CREATE TABLE foo ( ... ) CHARACTER SET utf8 COLLATE utf8_general_ci;

or

CREATE TABLE foo (
bar varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL);

mysql's default character encoding is latin1.

for mysql's collations, see: http://www.collation-charts.org/

i wouldn't use utf8 indiscriminately, only for columns that need it --
indexes need 3 bytes per character on utf8 columns. (utf16 would be better
in that regard!)

don't forget to set session system variables, e.g. using SET NAMES or with
your api.


On 1/18/10 2:44 PM, "Gavin Towey" <gtowey@stripped> wrote:

> http://dev.mysql.com/doc/refman/5.0/en/charset.html
> 
> 
> -----Original Message-----
> From: Ningappa Koneri [mailto:ningappa.koneri@stripped]
> Sent: Sunday, January 17, 2010 11:32 PM
> To: mysql@stripped
> Subject: Regarding storing non-english chars in mysql
> 
> Dear all,
> 
> I have a problem in migrating a GUI app(displays multi lingual data like
> Arabic) which currently uses oracle as backend db to mysql (5.1). Currenly in
> oracle I am using NVARCHAR datatype to store the Arabic chars. How do I
> incorporate the same functionality in mysql ? I have tried a sample
> servlet/jsp to insert the arabic chars into mysql by creating a table having
> two columns of NATIONAL VARCHAR type, but it's not displaying Arabic chars
> instead only questions marks are there.
> 
> One more thing in sample example is that before inserting I am converting to
> UTF-8.
> 
> Regards,
> Ningappa Koneri
> mLifestyle | www.comviva.com
> 
> 
> This e-mail and all material transmitted with it are for the use of the
> intended recipient(s) ONLY and contains confidential and/or privileged
> information. If you are not the intended recipient, please contact the sender
> by reply e-mail and destroy all copies and the original message. Any
> unauthorized review, use, disclosure, dissemination, forwarding, printing or
> copying of this email or any action taken pursuant to the contents of the
> present e-mail is strictly prohibited and is unlawful.
> The recipient acknowledges that Comviva Technologies Limited or its management
> or directors, are unable to exercise control or ensure the integrity over /of
> the contents of the information contained in e-mail. Any views expressed
> herein are those of the individual sender only and no binding nature of the
> contents shall be implied or assumed unless the sender does so expressly with
> due authority of Comviva Technologies Limited. E-mail and any contents
> transmitted with it are prone to viruses and related defects despite all
> efforts to avoid such by Comviva Technologies Limited.
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 
> 
> This message contains confidential information and is intended only for the
> individual named.  If you are not the named addressee, you are notified that
> reviewing, disseminating, disclosing, copying or distributing this e-mail is
> strictly prohibited.  Please notify the sender immediately by e-mail if you
> have received this e-mail by mistake and delete this e-mail from your system.
> E-mail transmission cannot be guaranteed to be secure or error-free as
> information could be intercepted, corrupted, lost, destroyed, arrive late or
> incomplete, or contain viruses. The sender therefore does not accept liability
> for any loss or damage caused by viruses or errors or omissions in the
> contents of this message, which arise as a result of e-mail transmission.
> [FriendFinder Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089, USA,
> FriendFinder.com
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 


Thread
query returning empty rowbharani kumar17 Jan
  • Re: query returning empty rowDan Nelson18 Jan
    • Re: query returning empty rowbharani kumar18 Jan
      • Regarding storing non-english chars in mysqlNingappa  Koneri18 Jan
        • RE: Regarding storing non-english chars in mysqlGavin Towey18 Jan
          • Re: Regarding storing non-english chars in mysqlfsb18 Jan
            • RE: Regarding storing non-english chars in mysqlNingappa  Koneri19 Jan
              • Re: Regarding storing non-english chars in mysqlfsb19 Jan
                • RE: Regarding storing non-english chars in mysqlJerry Schwartz19 Jan