[ 
http://jira.codehaus.org/browse/MSQL-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=163640#action_163640
 ] 

John Newman commented on MSQL-33:
---------------------------------

http://en.wikipedia.org/wiki/Byte-order_mark  

Unicode files can use the first byte of the file to signify that it is in fact 
a unicode file.. the whole thing is a mess, sorry to drag you into character 
encoding hell, but we are almost totally out. =)

A simple test case is attached.  Edit the pom for your DB config.  First test 
runs file that does not have byte order mark, pass.  Second test fails on the 
mark, it would be sweet if the plugin knew to skip it.  There is a lot of 
inconsistency, certian tools and standards force us to use the mark, but at the 
exact same time, the same people that are saying "it's good, we want you to use 
it" half of their tools don't support it anyway!  ..

quick outline of fix:

void sendSQLFile()  {
  boolean isUnicode = config.encoding. != null && config.encoding.substring(0, 
3) == "UTF";
  char c = readTheFirstCharOfFile();
  if (c == 0xFEFF&& isUnicode  && config.unicodeFilesHaveByteOrderMark)  {  // 
0xFEFF is the literal for the BOM, maybe add a config parameter for this 
defaulted to false?
     // ignore c;
  }
   readRestOfFile();
}


> UTF-8 Files with byte order mark are not handled correctly
> ----------------------------------------------------------
>
>                 Key: MSQL-33
>                 URL: http://jira.codehaus.org/browse/MSQL-33
>             Project: Maven 2.x SQL Plugin
>          Issue Type: Bug
>            Reporter: John Newman
>
> Hi,
> If a UTF-8 file does include the BOM, it will always fail with "Incorrect 
> syntax near ?" where ? is the first character of the file.  UTF-8 files 
> without the BOM work fine.
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to