qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Godfrey <rob.j.godf...@gmail.com>
Subject Re: Issue related to Special Characters
Date Wed, 09 Nov 2016 17:17:27 GMT
I'm pretty sure your issue is nothing to do with Qpid, but simply that you
are using a different character encoding for converting String data to
bytes on your sender and receiver.

Your code here:

	File newFile = new File(finalPath);
	FileWriter fw = new FileWriter(newFile);
	fw.write(data);
	fw.close();		


will use the default character encoding of the machine you are running on
to convert the String data into bytes.  Unless you use the same character
encoding on the receiver side, then you will get unexpected characters.  If
you want to ensure that the String data is encoded in  ISO-8859-1 you would
need to do something like

	File newFile = new File(finalPath);
	OutputStreamWriter fw = new OutputStreamWriter(new
FileOutputStream(newFile), StandardCharsets.ISO_8859_1);
	fw.write(data);
	fw.close();		

Out of interest why are you passing the file data as a byte[] rather than
as a String?  You seem to be later writing out the data structure as an
Object message anyway, so why not retain the Java type?

Hope this helps,
Rob

On 9 November 2016 at 11:29, Akhil Samnotra <samnotraakhil@gmail.com> wrote:

> Hi rob
>
> Sorry for the delayed response .
> I'm attaching a file where the functions are there and the description of
> the functions .
> It will give you an idea of how we are doing it .
> If you require the input and output files do let me know . But I have
> already explained and shown you the special characters .
>
>
> Thanks
>
> Akhil Samnotra
>
> Sent from my iPhone
>
> On 02-Nov-2016, at 8:49 PM, Rob Godfrey <rob.j.godfrey@gmail.com> wrote:
>
> Did you say you are using bytes messages?  How are you converting those
> messages into character data?  My first thought would be that this is an
> application issue not an issue within Qpid, but it would be good if you
> could provide some code that demonstrates what you are seeing.
>
> Thanks,
> Rob
>
> On 2 November 2016 at 13:06, Akhil Samnotra <samnotraakhil@gmail.com>
> wrote:
>
>>  Hi rob ,
>>
>> We are using Java client as 1.7,
>> Qpid client is 0.18
>> Qpid server-0.32
>> The Java client for AMQP 0-9,0-10 and 0-8
>>
>> As our Java version was older so on using latest client we were getting
>> some compatibility issue
>>
>> Thanks
>>
>>
>> Sent from my iPhone
>>
>> On 02-Nov-2016, at 5:49 PM, Rob Godfrey <rob.j.godfrey@gmail.com> wrote:
>>
>> Which Java client are you using?  The Java client for AMQP 0-9/0-10 or
>> the Qpid JMS client for AMQP 1.0?  Are you using the same client at both
>> the sender and the receiver?
>>
>> -- Rob
>>
>> On 2 November 2016 at 11:22, Akhil Samnotra <samnotraakhil@gmail.com>
>> wrote:
>>
>>> Hi Rob,
>>>
>>> Our broker is java , client is java and the version we are using is 0.32
>>> version
>>>
>>> Thanks
>>>
>>> Akhil Samnotra
>>>
>>>
>>> Sent from my iPhone
>>>
>>> > On 02-Nov-2016, at 3:38 PM, Rob Godfrey <rob.j.godfrey@gmail.com>
>>> wrote:
>>> >
>>> > Hi Akhil,
>>> >
>>> > can you give a little more information about which Broker (C++ / Java),
>>> > which client (Java, C+, Python, etc), and which versions of the broker
>>> and
>>> > client you are using?
>>> >
>>> > Thanks,
>>> > Rob
>>> >
>>> >> On 2 November 2016 at 08:36, Akhil Samnotra <samnotraakhil@gmail.com>
>>> wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> We are using Apache qpid as broker between Oracle 10 g DB and our
>>> >> application. The message that is passed onto QPID is in a byte format
>>> and
>>> >> it has both rtf content and the xml content coming from the DB.
>>> >>
>>> >> The encoding used in the database is ISO-8859-1.
>>> >>
>>> >> It was observed when some special characters that were there in one
>>> of the
>>> >> XML was passed onto the QPID as a message they got changed with ? or
>>> some
>>> >> other format .
>>> >>
>>> >> And once this message, stored on the local file system and used by the
>>> >> application, these special characters were seen as ?.
>>> >>
>>> >> We want to keep these characters intact.
>>> >>
>>> >> The characters are:
>>> >>
>>> >> °
>>> >>
>>> >> :
>>> >>
>>> >> { ( [
>>> >>
>>> >> ± ≠
>>> >>
>>> >> µ
>>> >>
>>> >> π
>>> >>
>>> >> Ω
>>> >>
>>> >> –
>>> >>
>>> >> -
>>> >>
>>> >> The Character as seen inside QPID Message Queue:
>>> >>
>>> >> ?
>>> >>
>>> >> ?
>>> >>
>>> >> { ( [
>>> >>
>>> >> ± â‰
>>> >>
>>> >> µ
>>> >>
>>> >> π
>>> >>
>>> >> Ω
>>> >>
>>> >> –
>>> >>
>>> >> -
>>> >>
>>> >> The characters seen in the applicatoion:
>>> >>
>>> >>
>>> >>
>>> >> ?
>>> >>
>>> >> ?
>>> >>
>>> >> { ( [
>>> >>
>>> >> ± ?
>>> >>
>>> >> µ
>>> >>
>>> >> ?
>>> >>
>>> >> ?
>>> >>
>>> >> ?
>>> >>
>>> >> -
>>> >>
>>> >> Also, the encoding used in the application is ISO-8859-1.
>>> >>
>>> >> Hence, can you please let us know how we can keep these characters
>>> intact.
>>> >>
>>> >>
>>> >> Thanks
>>> >>
>>> >>
>>> >> Akhil Samnotra
>>> >>
>>> >> +91-7888044049
>>> >>
>>>
>>
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message