You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Ed Anuff (JIRA)" <ji...@apache.org> on 2011/03/24 18:31:05 UTC

[jira] [Issue Comment Edited] (CASSANDRA-2379) ByteBufferUtil#bytes(String) can produce undesired results for some characters

    [ https://issues.apache.org/jira/browse/CASSANDRA-2379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010785#comment-13010785 ] 

Ed Anuff edited comment on CASSANDRA-2379 at 3/24/11 5:29 PM:
--------------------------------------------------------------

Actually, it may a good idea to avoid using Charset.defaultCharset() anywhere in ByteBufferUtil and probably elsewhere as well.  On the Mac, at least, that's going to be "MacRoman" and on all platforms may change due to the settings of the system "file.encoding" property.  Shouldn't we be making sure we're using UTF8?

      was (Author: edanuff):
    Actually, it may a good idea to avoid using Charset.defaultCharset().  On the Mac, at least, that's going to be "MacRoman" and on all platforms may change due to the settings of the system "file.encoding" property.  Shouldn't we be making sure we're using UTF8?
  
> ByteBufferUtil#bytes(String) can produce undesired results for some characters
> ------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-2379
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2379
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Nate McCall
>         Attachments: 2379.txt
>
>
> The difference between getBytes(java.nio.charset.Charset) vs. getBytes("[charsetname]") on some platforms (mac it seems) can be substantial. From the java.lang.String javadoc for the former:
> This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement byte array...
> vs. the latter:
> The behavior of this method when this string cannot be encoded in the default charset is unspecified.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira