• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

StringBuffer Problem or URLConnection ??

 
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I would like some help with the reading of data using URLConnection class, here is my code to read the data


And then i use sbData.toString() to convert the data into String so that i cna use it for further processing, now the problem here is that the data that i read is encrypted for example i will give you the sample data


The above is the actual data that we have to read but what i read is the below, if you check there are some extra chars added while i read the data,




I am not sure how this is done can any body suggest any other method for reading such data using urlconnection. Thanks in advance!

Thanks and regards
Harish

JCE: disabled smilies and trimmed the examples - feel free to repost them if I took out something that's important
[ February 17, 2006: Message edited by: Joe Ess ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is that binary data? Don't use a Reader.
Is that text? You will have to use a Reader with the same encoding to get the correct results.
 
Harish Tam
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply, but i think i have solved the issue out here, byt using the following changes in the reading data



This have done the trick, while reading the data there are no extra chars added now, but there is still one more issue here, just wanted to know how java interrpret the euro symbol, here is the brief, what is done here is that the data is excrypted and this is simply done by adding 9 to each char this is done using a MSSQL database proc, and in java we read the data and convert it back to the original form, by taking each and every char and subtracting 9 from it, now the problem comes to chars which have their acsii value more then 127, i have check the value of 128 is different then what is interpreted by java, actually the 128 char represents euro, but in java it is different, and when we try to decrypt the data it is not decrypted correctly only for chars which are higher then 127......

So any body can suggest as to how can we maintain the same charset with java......

Regards
Harish
 
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic