Can anyone help with sending non-Ascii messages?

I'm currently writing a small application that sends and receives encoded messages through JavaMail. Here's the problem: each character in the string that I'm sending can be up to 11 bits long and I'm apparently losing accuracy while emailing encoded text.
Apparently, JavaMail treats Strings as a series of bytes, while Java treats Strings as a series of integers. When I try
String message = "Message to code";
message = encodeMessage(message);
message = decodeMessage(message);
and then print out the contents of message, I get the correct contents of message. However, when I try
String message = "Message to code";
message = encodeMessage(message);
Message msg;
msg.setContent(message, "text/plain");
and then receive the message and read the contents, the contents are changed. I tried a for/while loop to see what the string "message" was holding before and after I emailed it. The results:
Before:
Encoded text as integers: 74 196 478 1006 1921
After:
Decoded text as integers: 74 196 63 63 63 13 10
Can anyone give me suggestions on how I can send this data without losing accuracy? I had the idea of sending an int[] array, but I can't see an easy way of doing that... I'm fairly new to JavaMail, so any help is greatly appreciated :-)
Thanks,
Robert Chatham

I've figured out a solution only to come up with an even more bizarre problem. JavaMail is now inserting random bytes into my message.
My code:
(When sending the email):
String encodedMessage;
msg.setContent(encodedMessage);
(When receiving the email):
String encodedMessage = (String)msg.getContent();
I've printed out a list of the bytes in each string immediately before sending the encoded message and immediately after receiving the encoded message. I'm doing absolutely nothing to the message between the times I send and receive it (and I don't think there's a way to, considering that it's off at the mail server.)
Take a look at a sample of the bytes of the encoded message before sending and after receiving (I added parenthesis for emphasis):
0 74 1 96 4 78 10 6 19 21 18 87 17 65 14 13 7
0 74 1 96 4 78 (13) 10 6 19 21 18 87 17 65 14 13 (10) 7
So... what is causing these extra bytes to be inserted into my message? In ascii format, the two bytes represent (I believe) line feed and form feed - but why inserted, and why so randomly?
Thanks,
Robert

Similar Messages

  • Can anyone help with the following error message?

    While installing itunes update 7.5 received message Error 1905 module c:\programfiles\itunes\itunesminiplaayer.Dl failed to unregister HRESULT-2147220472

    I noticed no one replied to your questions but was wondering what you found out. I had an ipod shuffle and just replaced it with a 3rd gen ipod nano. The new nano who not show up on my itunes so I went in to update it to the new version and received the same exact error message you did. Were you able to figure out a solution?
    Any help you can give would be greatful.

  • I downloaded the icloud software on my computer in order to sync calendars and contacts using Windows 2007, but I keep getting an error message when trying to sync my icloud and Outlook calenders - can anyone help with this?

    I downloaded the icloud software on my computer in order to sync calenders and contacts using Windows 2007, but I keep getting an error message when trying to sync my icloud and Outlook calendars.  I downloaded it for the first time a month ago and  had it working but it stopped syncing, so I deinstalled the iCloud software and reinstalled, but keep getting the error message "Your setup couldn't be started because of an unexpected error.  What do I do now?  Can anyone help with this?

    Hello easbda,
    Thank you for providing the details of the calendar issue you are experiencing with your iPhone.  I recommend following the steps in the section titled "Troubleshooting on Microsoft Windows (Microsoft Outlook)" in the following article to assist with syncing your calendar events between your devices:
    iCloud: Troubleshooting iCloud Calendar
    http://support.apple.com/kb/ts3999
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Cannot open Contact Sheet II on my Elements 12, gives me error message. Can anyone help with this?

    In Elements 12, I cannot open Contact Sheet II. I keep getting an error message.  Can anyone help with this?

    That's a different file.
    Try this:
    1. Click on your desktop
    2. Then in the Go menu click on Go To Folder
    3. Paste the following line in the Go To Folder dialog and press Go
    ~/Library/Preferences/Adobe/Plugins/Adobe Contact Sheet II PSE12/Elements
    4. That should open a finder window something like below.
       Drag the Adobe Contact Sheet PSE12 Prefs to the Trash on the dock
    5. Start the pse 12 editor and see the contact sheet II works.

  • I have uninstalled and reinstalled iTunes several times, but keep getting an error message that "the registry settings for importing and burning CD's and DVD's is missing".  Can anyone help with this?

    I have uninstalled and reinstalled iTunes several times, but keep getting an error message that "the registry settings for importing and burning CD's and DVD's is missing".  Can anyone help with this?

    It keeps telling me to reinstall iTunes, but it continues to come back with the same error message.

  • HT2534 If only it were that simple. Many of us have no "none" available.  Since the guy on the other discussion clearly had no desire to help anyone, I thought I'd ask here instead... can anyone help with this?

    If only it were that simple. Many of us have no "none" available.
    Since the guy on the other discussion clearly had no desire to help anyone, I thought I'd ask here instead... can anyone help with this?

    Open iTunes and navigate to the app store. Select a free app to download. A simple way to do this is to scroll down to the top free apps box on the right hand side, hover your mouse over the first item and click on the free button that appears when you hover over it.
    A pop up will open asking you to sign in with your Apple ID click "create new account", click continue to create your account. Check the box to accept the store terms and conditions and click continue.
    Enter your email address, password, security question, and date of birth, click continue. Now, you will be asked to provide a payment method. Note now that the last option says "none".

  • Can anyone help with email in my old G4 17"  ??

    My G4 17", bought December 2004, is considered an antique by Apple, and no longer supported. (I now mostly use my early 2011 MacBookPro.)
    But the big screen on by G4 is very useful for Sibelius 4, the music program I mostly use (Sibelius 7 in the MacBookPro - but much too fussy for me.)
    Sibelius 4 in the G4 continues to work flawlessly.
    But my email account recently sort of died. It's  POP account (whatever that means). I can no longer receive messages, BUT I can still create and
    send new messages, and of course forward any saved message to myself in the MacBookPro.
    ALSO:  if I have to shut down the G4, it usually reopens with a horizontally divided display, and it usually takes many restarts before it will open
    will a full screen display (seems to reopen correctly more often if left in a cool place overnight.)
    Can anyone help with one or both these issues? I want to keep the G4 going as long as I can.  BTW, I don't use it for browsing anyone, Safari installed,
    because it is now so slow. The MacBookPro handles all that for me.
    Thanks very much, James Johnson in Plattsburgh NY (where it is still cold and wintry, o f--k)

    To RCCHARLES: THANKS !!!!  I did the safe boot start, following the link you provided, then waited, and waited, and waited, and ---
    Well that is interesting. Amoung other things safe boot does:
    -- check and fixes up your file system.  The files system allows you to keep files on your harddrive.
    -- Does all video rendering in software.
    You could have a one time glitch or harddrive is slowly failing.  If you never replaced the harddrive, it is time for a new one.
    You may want to consider getting a new harddrive.  The easiest way is to get an external drive.  No disassembly of the machine is required.
    You need an external Firewire drive to boot a PowerPC Mac computer [ a few G5's will boot from USB ].
    I recommend you do a google search on any external harddrive you are looking at.
    I bought a low cost external drive enclosure. When I started having trouble with it, I did a google search and found a lot of complaints about the drive enclosure. I ended up buying a new drive enclosure. On my second go around, I decided to buy a drive enclosure with a good history of working with Macs. The chip set seems to be the key ingredient. The Oxford line of chips seems to be good. I got the Oxford 911.
    I'd give OWC a call. 1-815-338-8685.
    FireWire 800 + USB 3, + eSATA
    save a little money interface:
    FireWire 400 + USB 2.0
    This web page lists both external harddrive types. You may need to scroll to the right to see both.
    http://eshop.macsales.com/shop/firewire/1394/USB/EliteAL/eSATA_FW800_FW400_USB
         (2) FireWire 800/400 Ports (Up to 100MB/s / 50MB/s)
         (1) USB 3.0 Port (Up to 500MB/s / 60MB/s)
         (1) eSATA Port (Up to 300MB/s)
    Has a combo firewire 800/400 port.  Not sure what this is.  Looks like you will  need 400 cable.
    http://eshop.macsales.com/shop/ministack

  • OniPhone 6 Plus. Connectinge 6 Plus. Connecting Bluetooth to my Prius bluetooth has been successful However, I am unable to answer or place calls via the bluetooth connection even though the connection has been established. Can anyone help with this?

    With my new iPhone 6 Plus. Connectinge 6 Plus. Connecting Bluetooth to my Prius bluetooth has been successful. However, I am unable to answer or place calls via the bluetooth connection even though the connection has been established. It worked well with my previous iPhone 4S. Can anyone help with this?

        I can see that this issue has been quite extensive, and frustrating, and I am so sorry for all that has happened societygirl! I would like to help you work this issue out. Please follow & send me a Direct Message, so I can get your account specifics and help finally bring this to a resolution.
    Thank you,
    MichelleH_VZW
    Follow us on Twitter @VZWSupport

  • Can anyone help with iPlayer and Sky Mobile?

    Ok, I'm so close to giving up with this useless phone. There are 3 apps on my N97 which give me a constant headache.
    BBC iPlayer
    Sky Mobile*
    YouTube
    *I should point out that I only use Sky Mobile to set recordings on my Sky+. I do not use it for, nor have any desire to use it for actually watching Mobile TV.
    All of these apps work absolutely fine over my home WiFi network. It's when I try to use them over 3G (my Vodafone Live! connection) that I start running in to trouble.
    All 3 give me connection problems, errors, and simply refuse to load half the time when on 3G. I got so annoyed I just did a hard reset the other week, and magically all three started working again. However, now 2 of them are failing me again. YouTube (touch wood) is working fine at the moment, but iPlayer and Sky Mobile just aren't.
    iPlayer sometimes works. But sometimes I get script errors (unable to load content), and sometimes it says something about checking my connection settings. I wouldn't mind but it's not actually possible to access any options for the iPlayer. Even in application settings there are no options you're able to set.
    Sky Mobile simply flat out refuses to work ever on 3G. But it did after I did a hard reset for a couple of weeks, now it just stopped working! It wont even load. It just gives the error message 'Unable to connect to network - please check connection settings" or something along those lines.
    I've tried so many different things. Tried setting my internet connections to 'always ask', tried setting it to default to Vodafone Live! all the time, tried setting my video streaming settings to WAP, all sorts. Every combination I can think of.
    I just can't wait to get rid of this phone. I've put so many people off buying one. They see it and think it's all swish and cool, and I just say 'Don't. You'll regret it'. I can't wait for my contract to be up so I can upgrade to an iPhone now Vodafone have got them.
    Can anyone help with these problems? Thanks in advance, but I don't hold out much hope...

    About iPlayer.
    Have a chat with Vodaphone. Streaming iPlayer over 3G IS allowed on Vodaphone contract, unlike my O2 contract. As long as your contract allows it, and you have the correct AP address, it should be fine. Vodaphone should be able to give you the setting.
    Mine only works over Wlan.
    FWIW, "... streaming over 3G is not currently available on iPhone handsets on any mobile network".
    p.s. Just to be clear. You say  "Tried setting my internet connections to 'always ask', tried setting it to default to Vodafone Live!".
    iPlayer uses the Nokia browser "Web". So that's where you should make the setting "Ask when needed". It should then offer you the choice of whatever you've set in Destinations> Internet> then select whatever you've chosen as your GPRS connection.(as advised, or sent to you by Vodaphone).

  • Can anyone help with AirPrint

    Can anyone help with this. I recently purchased an Airport Express unit to connect to my Canon MP 640 via USB. I was advised to download the airport utility app for both my iPad and iPhone, which I did. I also downloaded it on my pc. I have connected the Airport Express to my Orange router via wired LAN and my printer is connected to Airport Express via USB. A new wireless network has now been setup via the Airport so I can connect my iPad, iPhone and Apple TV. The printer is showing in the airport utility on my pc but I cannot print anything from my iPad and phone. The both connect to the Airport Express but cannot find the printer. They both come back with " no AirPrint printer found". Can anyone help with this.

    Thanks for that guys. I can stop tearing my hair out now. I have the Printcentral app on both devices and there are several options I can use from this, but not direct print to my printer. The Pages and Numbers apps need to update with a 'send to' option I think. Canon have an app for printing photos which works well on both iPhone and iPad, may be they need to update to include docs too. I don't realy want to spend any more money on a new printer as my Canon MP640 does a good job on my photos. Oh well, back to iCloud. Thanks again for your help.

  • Can anyone help with this issue.... intermittent sound from apple tv

    Can anyone help with this issue?..watched the trailer of a movie with sound, then downloaded and went to watch it, but no sound and this message was displayed:"an incompatible audio signal has ben received.check the output device" tv is a sharp aquos

    I don't know if this will help but have you tried switching the audio output to 16-bit? On the AppleTV, click Settings, Audio & Video, Audio Output. The two choices are "auto" and "16-bit". Good luck!

  • Cant download new U2 album. |Says purchased on my account but no evidence anywhere and I definitely did not purchase it. Can anyone help with what is going on?

    Cannot download new U2 album. Says purchased on my account but no evidence anywhere and I definitely did not purchase it. Can anyone help with what is going on?

    It was given free to everyone on tuesday as part of the iPhone 5 event/announcement, so it will show as purchased in the store.
    If this is on your iPhone then either turn Settings > iTunes & App Store > Music (under 'show all') 'on' - it should then show in the Music app with a cloud icon against it for downloading.
    Or go to the Purchased tab in the iTunes store app, select Music, and it might then show under 'Various' - when downloaded it should correctly be under U2 in Music.
    If you are using your computer's iTunes then you should be able to download it into your library by ticking the 'show iTunes in the Cloud purchases' tick box on the Store tab in Edit > Preferences (iTunes > Preferences on a Mac) - it should then show in the Music part of your library with a cloud icon against it for downloading (downloading the booklet for it this way may not work, you may get a 'corrupt file' message when trying to open it).
    Or go to the Purchased link under Quick Links on the right-hand side of the iTunes store homepage and you should be able to download it from there.
    A third option on a computer is to sign out of your account (Store > Sign Out menu option), find the album in the store and then click on its free 'price' button - you should then be prompted to sign back in and the album should download.

  • Can anyone help with this error? ;At line 102 of file"C:/Program files (x86)/Macromedia/Dreamweaver

    Can anyone help with this error please?;At line 102 of file"C:/Program files (x86)/Macromedia/Dreamweaver 8/Configuration/Objects/Common/Images.js"; TypeError: cmdDOM.parentWindow.setFormItem is not a function

    If Dreamweaver shows a message saying "the following JavaScript error(s) occurred",  it's usually a sign of a corrupt cache file. The first thing you should always be to delete the file cache. If that doesn't work, delete your personal Configuration folder. Please go through the steps mentioned in thread Deleting a corrupted cache file.

  • Hi, can anyone help with the problem I am having with pro book 4440s? I can't boot into windows 7.

    Hi, can anyone help with the problem I am having with pro book 4440s?  I can't boot into windows 7, nor can I enter the bios cause i fogot the password. the error I am getting says "windows failed to start. a recenr hardware or software change might be the cause.   it then gives me options to boot from a disc but I can't do that cause I am unable to get into the bios to change it to boot from a disc.
    The error message goes on :
    File: \Boot\BCD
    Status: oxcoooooof
    info: An error occurred while attempting to read the boot configuration.
    the only two options on the screen are enter=continue and ECS=exit
    I just can't get pass this screen.
    Please help.
    Thanks

    Hi,
    If you don't already have one, use another PC to create a Windows 7 Rescue CD.  Download the relevant ISO from the links below.
    Windows 7 32bit
    Windows 7 64bit
    You should use an application such as ImgBurn to burn the ISO to a CD - a guide on using ImgBurn to write an ISO to a disc is Here.  Once created, or if you already have this, tap away at the esc key as you start the notebook to enter the Start-up Menu.  Insert the Rescue CD.  Select Boot options ( usually f9 ), use the arrow keys to select the CD/DVD drive and hit enter.  You may also get a prompt to 'Press any key to continue' - do this if asked.
    When loaded, select Repair Your Computer and choose the Command Prompt.  When this loads, enter the following commands and hit enter after each one - include spaces as shown.
    Bootrec.exe
    bcdedit /export C:\BCD_Backup
    c:
    cd boot
    attrib bcd -s -h -r
    ren c:\boot\bcd bcd.old
    bootrec /RebuildBcd
    bootrec /fixmbr
    bootrec /fixboot
    Remove the Rescue CD and try rebooting the notebook.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • HT201407 Hi, can anyone help with Iphone 4, is stuck on Connect to iTunes

    What I need to do, if is showing on Iphone 4 - Connect to iTunes
    1.What I did conect to itunes then come up mesage:
    There is a problem with your iPhone.
    Please visit the Service Answer Center to find answers to all your questions about service options, warranty and other processes in your country.
    To find your nearest Apple Store, click here.
    2. I visited the apple store and they try restore the iphone and hapend but nothing changed is come up again the message.
    So one man from enginering take a phone for check and he sai that may be is been replaced the sreen and is not from apple brand, so may be for that reson is showing mesage.
    3. I open the phone and take out main board and put to good working phone. So what hapeand? same thing, same mesage come up. Never mind, I conect to itunes and hold button with power buton to restore phone again, but nothing changed same mesage on itunes.
    4. I check the IMEII if is blocked or no and is unblocked.
    Can anyone help with this issue?
    Thanks

    Nothing anyone can do for you. You have a second hand phone that's been repaired by an unauthorized 3rd party using counterfeit, stolen, or salvaged parts. Apple won't touch it, as you've learned.
    Buy a new phone. Preferably, from a legitimate source.

Maybe you are looking for