RE: Installing using utf-8 and mssql server? Another solution

[email protected]
Newsgroups gmane.comp.cms.jahia.install
Message-ID <OF833BDC37.018D8361-ONC125708A.0036ED52-C125708A.0036ED58@generic.se>
hi!

I did another try and if I put the letter N in front of the string literal the comparision test succeeds.

// Empty table
Statement statement1 = connection.createStatement();
statement1.execute("delete jahia_db_test");

// Insert string
Statement statement2 = connection.createStatement();
String testField = "Latin : ���� / Cyrillic : \u0419\u0416 / Chineeze : \u8bed\u8a00";
statement2.execute("insert into jahia_db_test (testfield) values (N'" + testField + "')");

// Fetch and compare
Statement statement3 = connection.createStatement();
ResultSet rs = statement3.executeQuery("select * from jahia_db_test");

while (rs.next())
{
String test = rs.getString(1);
if (test.equals(testField))
{
System.out.println("OK"); <----- Result
}
else
{
System.out.println("FAIL");
}
}

So all we have to do is wait for a jahia release which prefixes all string literals with the N letter when updating or inserting strings into the database :->

Regards

/Lars Hagrot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.