Cups4J.org

The Cups4J user Forum
It is currently Sat Sep 23, 2017 4:42 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Bug in IppTag
PostPosted: Fri May 24, 2013 11:39 am 
Offline

Joined: Fri May 24, 2013 10:47 am
Posts: 1
Hello,

We noticed some problems with the Ippclient when using multi-byte characters. There is a bug in IppTag.java class where the length of the string is written incorrectly into the IppBuffer for multi-byte characters.

This is the code in IppTag (this is used in multiple places in IppTag class):

ippBuf.putShort((short)attributeName.length());
ippBuf.put(IppConverter.toBytes(attributeName));

The problem is that the length of the string is not the same as the length in bytes after encoding as some encodings have multy-byte characters (for example utf-8). We noticed this when sending a printjob with a job-name containing characters like è, é, ê, ë.

My fix would be as follows:

byte [] bytes = IppConverter.toBytes(attributeName);
ippBuf.putShort((short)bytes.length);
ippBuf.put(bytes);

I also informed the maker of ippclient (https://trac.id.ethz.ch/projects/ippclient) of this problem and they will release a fix shortly.

Cheers,

Rien Nentjes


Top
 Profile  
 
 Post subject: Re: Bug in IppTag
PostPosted: Sun Jun 02, 2013 5:02 pm 
Offline

Joined: Wed Jan 05, 2011 9:44 pm
Posts: 44
Location: Germany
This will be fixed in the next version.

Thanks for your path.

Cheers Harald


Top
 Profile  
 
 Post subject: Re: Bug in IppTag
PostPosted: Fri Jul 12, 2013 7:58 pm 
Offline

Joined: Wed Jan 05, 2011 9:44 pm
Posts: 44
Location: Germany
I just uploaded a new version of cups4j with this bug fixed and some logging features.

Harald


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group