Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ant target to populate MySQL database garbles Japanese content

Status
Not open for further replies.

javapiet

Programmer
Aug 3, 2006
1
BE
I have a target to populate a UTF8 supporting MySQL database with a UTF8 encoded .sql file. This works fine.
I have another target populating the same database based on 2 different UTF8 encoded .sql files. This target causes some random Japanese characters to be garbled in the database.

This is the double target:
Code:
<target name="create-db-fire" depends="create-db">

   <echo level="info">Inserting Minimal Data ...</echo>
   <property name="tmp.script" value="${database.script.dir}/db.sql" />
   <!-- copy to a different file to avoid CVS trying to merge -->
   <copy file="${database.populate.minimal}" tofile="${tmp.script}" overwrite="yes">	</copy>
   <!-- removing commented lines -->
   <replaceregexp byline="yes" file="${tmp.script}" match="^.*#.*$" replace=" "> </replaceregexp>
   <sql driver="${database.driver}" encoding="UTF-8" password="${database.password}" url="${database.url}" userid="${database.username}" src="${tmp.script}" classpath="${database.driver.jar}"> </sql>

   <echo level="info">Inserting Additional Data ...</echo>
   <!-- now the additional data -->
   <copy file="${database.populate.fire}" tofile="${tmp.script}" overwrite="yes"> </copy>
   <!-- removing commented lines -->
   <replaceregexp byline="yes" file="${tmp.script}" match="^.*#.*$" replace=" "> </replaceregexp>
   <sql driver="${database.driver}" encoding="UTF-8" password="${database.password}" url="${database.url}" userid="${database.username}" src="${tmp.script}" classpath="${database.driver.jar}"> </sql>

   <!-- Deleting temporary scripts -->
   <delete file="${tmp.script}"> </delete>

</target>
[\code]

Anybody any idea why one file works but populating with 2 files garbles the content?

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top