0x96 character in command file

0x96 character in command file

am 10.04.2008 17:01:28 von Jerry Schwartz

I am having what I think is a weird problem. Here's my setup:

- I’m running Windows Vista.
- I've tried the exact same thing on Linux with the exact same result.
- I'm running the mysql CLI. The client is 5.0.45-community on the Vista
system, 4.1.22 on the Linux system.
- The server in both cases is 4.1.22 community, running on the Linux server.

Here's the problem. I perform the following operations by copying and
pasting the commands from an ANSI text file:

mysql> SET NAMES utf8;
Query OK, 0 rows affected (0.04 sec)

mysql> DROP TEMPORARY TABLE IF EXISTS eo_name_table;
Query OK, 0 rows affected, 1 warning (0.04 sec)

mysql> CREATE TEMPORARY TABLE `giiexpr_db`.`eo_name_table` (
-> `eo_name` VARCHAR( 255 ) UNIQUE NOT NULL
-> ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 0 rows affected (0.04 sec)

mysql> INSERT INTO eo_name_table
-> (eo_name)
-> VALUES
->
-> ("Disposable Paper Products - Uruguay");
Query OK, 1 row affected (0.04 sec)

mysql> SHOW WARNINGS;
Empty set (0.04 sec)

mysql> SELECT * FROM eo_name_table;
+-------------------------------------+
| eo_name |
+-------------------------------------+
| Disposable Paper Products - Uruguay |
+-------------------------------------+
1 row in set (0.05 sec)

That worked just fine.

The kicker is that what looks like a hyphen is actually an n-dash, 0x96.

If I source the exact same commands from the file I copied them from, I get
this:

mysql> source test_n-dash.sql;
--------------
SET NAMES utf8
--------------

Query OK, 0 rows affected (0.04 sec)

--------------
DROP TEMPORARY TABLE IF EXISTS eo_name_table
--------------

Query OK, 0 rows affected, 1 warning (0.04 sec)

--------------
CREATE TEMPORARY TABLE `giiexpr_db`.`eo_name_table` (
`eo_name` VARCHAR( 255 ) UNIQUE NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci
--------------

Query OK, 0 rows affected (0.04 sec)

--------------
INSERT INTO eo_name_table
(eo_name)
VALUES
("Disposable Paper Products û Uruguay")
--------------

Query OK, 1 row affected, 1 warning (0.04 sec)

--------------
SHOW WARNINGS
--------------

+---------+------+------------------------------------------ ----+
| Level | Code | Message |
+---------+------+------------------------------------------ ----+
| Warning | 1265 | Data truncated for column 'eo_name' at row 1 |
+---------+------+------------------------------------------ ----+
1 row in set (0.04 sec)

--------------
SELECT * FROM eo_name_table
--------------

+---------------------------+
| eo_name |
+---------------------------+
| Disposable Paper Products |
+---------------------------+
1 row in set (0.04 sec)

In summary, the character 0x96 truncates the quoted value, but is reported
as "Data truncated..." as though the title were too long.

Why does this work when I type paste this directly in? More importantly, why
does it NOT work when I source the file and what can I do about it?

There is much too much data to paste.

Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org