You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by rami dabbah <rz...@gmail.com> on 2018/05/16 11:00:46 UTC

Cassandra java driver linux encoding issue

Hi,

I am trying to query text filed from Cassandra using java driver see code
below. In windows it is working fine but in linux i am getting ??????
instead of Chines characteres


Code:

ResultSet shopsRS =
this.cassandraDAO.getshopsFromScanRawByScanId(cassandraSession,"scan_raw",scanid);
    String record = null;
    for (Row row : shopsRS){
try {
pProtocol.addEvent(new
BaseEvent(BaseEvent.LEVEL_ERROR,"Charset.defaultCharset():"+Charset.defaultCharset()));
record =row.getString("raw_data");
Helper.verifyEncoding(record);
String updated_record =
Helper.addAttributeToJsonString(pProtocol,row.getString("raw_data"),CommonVars.AUX_DATA,CommonVars.AUX_DATA_BATCH_ID,batchId);
Helper.verifyEncoding(updated_record);
producer.sendMessage( updated_record);
counter++;
} catch (IOException e) {
pProtocol.addEvent(new BaseEvent(BaseEvent.LEVEL_ERROR,"Could not send
Message: "));
            e.printStackTrace();
}



example text:

"details_product_name":"佛罗伦萨万豪AC酒店(AC Hotel Firenze)|"


-- 
Rami Dabbah
<http://www.linkedin.com/profile/edit?goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=spm_pic>
Java Professional.

Re: Cassandra java driver linux encoding issue

Posted by Eric Stevens <mi...@gmail.com>.
What is the value returned from Charset.defaultCharset() on both systems?

On Wed, May 16, 2018 at 5:00 AM rami dabbah <rz...@gmail.com> wrote:

> Hi,
>
> I am trying to query text filed from Cassandra using java driver see code
> below. In windows it is working fine but in linux i am getting ??????
> instead of Chines characteres
>
>
> Code:
>
> ResultSet shopsRS =
> this.cassandraDAO.getshopsFromScanRawByScanId(cassandraSession,"scan_raw",scanid);
>     String record = null;
>     for (Row row : shopsRS){
> try {
> pProtocol.addEvent(new
> BaseEvent(BaseEvent.LEVEL_ERROR,"Charset.defaultCharset():"+Charset.defaultCharset()));
> record =row.getString("raw_data");
> Helper.verifyEncoding(record);
> String updated_record =
> Helper.addAttributeToJsonString(pProtocol,row.getString("raw_data"),CommonVars.AUX_DATA,CommonVars.AUX_DATA_BATCH_ID,batchId);
> Helper.verifyEncoding(updated_record);
> producer.sendMessage( updated_record);
> counter++;
> } catch (IOException e) {
> pProtocol.addEvent(new BaseEvent(BaseEvent.LEVEL_ERROR,"Could not send
> Message: "));
>             e.printStackTrace();
> }
>
>
>
> example text:
>
> "details_product_name":"佛罗伦萨万豪AC酒店(AC Hotel Firenze)|"
>
>
> --
> Rami Dabbah
> <http://www.linkedin.com/profile/edit?goback=%2Enmp_*1_*1_*1_*1_*1_*1_*1_*1_*1&trk=spm_pic>
> Java Professional.
>