473,408 Members | 1,601 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to enter Unicode strings?

How does one enter Unicode strings into a 5.0.3 MySQL table?
I tried things like
INSERT INTO tablename(colname) VALUES( _utf8'€©®á§A¦n')
But this doesn't work. I guess I need an escape sequence, but the MySQL
manual doesn't specify Unicode escape sequences, just for quotes,
newlines and such...

Thanks, Paul.
Jul 23 '05 #1
3 7049
Following example shows how you specify Unicode character set. This is
copied from the MySQL online manual at
http://dev.mysql.com/doc/mysql/en/charset-unicode.html

It was posted there, in the "User Comments" section of that page, by
Robert Mark Bram on September 26 2003:
Simple example:

CREATE TABLE `family` (
`name` varchar(100) NOT NULL,
`savings` decimal(3,2) NOT NULL default '0.00',
`dob` date NOT NULL default '0000-00-00',
PRIMARY KEY (`name`),
UNIQUE KEY `name` (`name`)
) TYPE=InnoDB CHARACTER SET utf8
;

Jul 23 '05 #2
Thanks for your reply, but this was not my question. I know how to
define the table, but there seems to be no way whatsoever filling the
table with actual Unicode strings (except programmatically through an
SQL driver, but not from a script or command line).

There just is no syntax for defining Unicode string constants with
characters other than (extended) ASCII. I would expect something like
the HTML escape sequence 水 or the Java "\u6c34" escape sequence,
but they forgot to define something like that...

Paul.

On 26-04-2005 23:34, sb*****@sb.net wrote:
Following example shows how you specify Unicode character set. This is
copied from the MySQL online manual at
http://dev.mysql.com/doc/mysql/en/charset-unicode.html

It was posted there, in the "User Comments" section of that page, by
Robert Mark Bram on September 26 2003:
Simple example:

CREATE TABLE `family` (
`name` varchar(100) NOT NULL,
`savings` decimal(3,2) NOT NULL default '0.00',
`dob` date NOT NULL default '0000-00-00',
PRIMARY KEY (`name`),
UNIQUE KEY `name` (`name`)
) TYPE=InnoDB CHARACTER SET utf8
;

Jul 23 '05 #3
This article may help you
http://dev.mysql.com/tech-resources/...1/unicode.html

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Weir | last post by:
I'm sure this is a very simple thing to do, once you know how to do it, but I am having no fun at all trying to write utf-8 strings to a unicode file. Does anyone have a couple of lines of code...
4
by: Guilherme Salgado | last post by:
Hi there, I have a python source file encoded in unicode(utf-8) with some iso8859-1 strings. I've encoded this file as utf-8 in the hope that python will understand these strings as unicode...
6
by: nico | last post by:
In my python scripts, I use a lot of accented characters as I work in french. In order to do this, I put the line # -*- coding: UTF-8 -*- at the beginning of the script file. Then, when I need...
4
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
2
by: Neil Schemenauer | last post by:
python-dev@python.org.] The PEP has been rewritten based on a suggestion by Guido to change str() rather than adding a new built-in function. Based on my testing, I believe the idea is...
5
by: Jamie | last post by:
I have a file that was written using Java and the file has unicode strings. What is the best way to deal with these in C? The file definition reads: Data Field Description CHAR File...
13
by: gabor | last post by:
hi, from the documentation (http://docs.python.org/lib/os-file-dir.html) for os.listdir: "On Windows NT/2k/XP and Unix, if path is a Unicode object, the result will be a list of Unicode...
24
by: Donn Ingle | last post by:
Hello, I hope someone can illuminate this situation for me. Here's the nutshell: 1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale. 2. If this returns "C" or anything...
13
by: George Sakkis | last post by:
It seems xml.etree.cElementTree.iterparse() is not unicode aware: .... print elem.text .... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 64,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.