You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Alex Miller <al...@modea.com> on 2008/04/08 19:03:47 UTC

sql task truncating utf8 input

Hello, I have just started using Ant as a build tool for my webservers
during the past few weeks and I am very happy so far.  Now I am trying
to populate a MySQL database from a file containing data using the utf8
charset.  I receive no errors, but whenever the INSERT VALUE contains a
unicode character (such as the left apostrophe) it is truncated from
that character on.

Example:
[sql] SQL:  INSERT INTO `some_table` VALUES (1,'Good data.'), (10','When
it’s windy... this is truncated'),(11,'Good data, and then It’s...
truncated after apostrophe')

This will insert data for each value, but it appears in the table like
this:
1  Good data.
10 When it
11 Good data, and then It

My sql task in build.xml contains the following:
<sql
  driver="${db.driver}"
  url="${db.url}"
  userid="${db.user.root}"
  password="${db.pass.root}"
  print="yes"
  classpath="${db.connector}"
  encoding="utf8"
>
  <transaction>
    DROP DATABASE IF EXISTS ${db.name};
    CREATE DATABASE ${db.name} CHARACTER SET utf8;
    USE ${db.name};
  </transaction>
  <transaction src="${basedir}/${dir.db}/${db.file}"/>
</sql>

When I run "ant -v db" the SQL data appears in full (everything after
unicode char's is visible) so I'm not sure when the data is being
truncated.  Has anyone else seen this behavior?  Where else should I
look to determine what function is the culprit?

Thanks,
Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org