Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Accumulo, mail # dev - Re: Setting Charset in getBytes()


Copy link to this message
-
Re: Setting Charset in getBytes()
Drew Farris 2012-10-31, 15:51
+1 for a configuration file property -- perhaps this could be worked
into the Encoding class David describes below.

On Tue, Oct 30, 2012 at 10:35 PM, John Vines <[EMAIL PROTECTED]> wrote:
> Why not just have a configuration in the xml file for setting a global
> charset? This way we avoid hard coded settings but also avoid the issue of
> shared vm issues.
>
> John
>
> Sent from my phone, pardon the typos and brevity.
> On Oct 30, 2012 10:29 PM, "David Medinets" <[EMAIL PROTECTED]> wrote:
>
>> Re-reading and re-thinking I can see your point about how, by
>> specifying UTF-8, Accumulo is now flouting the file.encoding
>> parameter. I'd like to implement a static method inside
>> core/src/main/java/org/apache/accumulo/core/util/Encoding.java. Then
>> do something like getBytes(Encoding.getCharset()) instead of
>> hard-coding UTF-8.
>>
>> Class Encoding {
>>   private static final Charset charset = null;
>>   public Charset getCharset() {
>>     if (charset == null) {
>>       charset = Charset.forName(System.getProperty("file.encoding",
>> "UTF-8"));
>>     }
>>     return charset;
>>   }
>>   ...
>> }
>>
+
David Medinets 2012-10-31, 16:46