jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes problem base64 encoding the 3 hex bytes E2 80 A9 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "problem base64 encoding the 3 hex bytes E2 80 A9" Watch "problem base64 encoding the 3 hex bytes E2 80 A9" New topic
Author

problem base64 encoding the 3 hex bytes E2 80 A9

Miguel Capo
Greenhorn

Joined: Oct 08, 2006
Posts: 14
Hi there,
I am having problems when I base64 encode a file that contains the 3 hex bytes E2 80 A9. When I decode the file I get the hex byte 3F.

Can some shed some light?

Thanks
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12950
    
    3

Show us your code. What are you using to do the Base64 encoding and decoding?

(This question isn't really an Advanced Java question).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Miguel Capo
Greenhorn

Joined: Oct 08, 2006
Posts: 14
Thanks for your help,

The classes below are the ones that I am using to do the encoding and the decoding.

[ May 11, 2007: Message edited by: Jim Yingst ]
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12950
    
    3

So you wrote your own Base64 encoder and decoder?

Is there a special reason why you wrote this yourself; why don't you use a well-tested library like Apache Jakarta Commons Codec?

If you encode and decode something and the result is different from the input, then there's obviously a bug somewhere in your code. Use a debugger to step through your code and see if it is doing what you expect it to do. You could also put System.out.println(...); statements in your code to print the value of variables at strategic places to see if the program is doing what you expect it to do.
Miguel Capo
Greenhorn

Joined: Oct 08, 2006
Posts: 14
Thanks for your advice,
I am using the Apache Jakarta Commons Codec and the problem has disappeared.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: problem base64 encoding the 3 hex bytes E2 80 A9
 
Similar Threads
Getting the MAC address and using that for licensing
IGNORE THE PREVIOUS BASE64 QUESTION!
Getting Sequence Tag Error
Cannot find the carriage return character
Weird characters when reading a file