Use properties to get character in file but some char could not be decode

i use properties class to get a file with Big5 character inside the file, but some character could not be display properly.....
sample code:
import java.io.*;
import java.util.*;
public class Frankie {
public static void main(String[] arg) {
try {
Properties p = new Properties();
p.load(new FileInputStream("file.ini"));
Enumeration e = p.propertyNames();
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
String value = p.getProperty(name);
String coded_value = new String(value.getBytes("iso-8859-1"), "Big5");
System.out.println(name + " : " + coded_value);
byte[] bBytes2 = coded_value.getBytes();
for (int k = 0; k < bBytes2.length; k++) {
System.out.println("byte " + "iso1" + "[" + k + "] = " + bBytes2[k]);
catch (Exception e) {
e.printStackTrace();
==================
file.ini
people=&#20320;
a=&#39184;
==================
result:
a : ?
byte iso1[0] = 63
people : &#20320;
byte iso1[0] = -89
byte iso1[1] = 65
==================
the proper byte of "&#39184;" should be (-64, 92).....
If i use a varible to store this character in the source code, and use value.getBytes("big5"), the byte could be properly display for this character....
how can i solve this? thanks a lot!

The Properties class javadoc says
The load and store methods load and store properties in a simple line-oriented format specified
below. This format uses the ISO 8859-1 character encoding. Characters that cannot be directly
represented in this encoding can be written using Unicode escapes ; only a single 'u' character
is allowed in an escape sequence. The native2ascii tool can be used to convert property files to
and from other character encodings.
which means you are not supposed to use "big5" encoding in your Properties text file
directly. There is a commandline tool "native2ascii" bundled with your jdk package that
you can use to convert your "big5" encoded Properties file into unicode escapes based
text file, then you no longer needs to play the trick
String coded_value = new String(value.getBytes("iso-8859-1"), "Big5");
p.getProperty(name) will give you exactly the correct "value" defined in your properties
file.
-x
btw, when using "native2ascii", if you are not in a "big5" env, using "-encoding big5" option
to force it.

Similar Messages

  • On some of my files there is a ! in front of it, if I try to play the song, I get an error message; "The song "_____" could not be used, because the original file could not be found. Would you like to locate it?" Then when I click "Locate", I get nothing.

    I'm really dumbfounded on this one and it's driving me bonkers!!!! On some of my music files there is a ! in front of it, if I try to play the song, I get an error message; "The song "_____" could not be used, because the original file could not be found. Would you like to locate it?"
    This began to happen when Chuck made playlists2burn on2CD-and then he would delete the playlist; sending all the song files into oblivion. Certain songs have a ! right next to the file name, and as I stated before, i get that error message:
    "The song "_____" could not be used, because the original file could not be found. Would you like to locate it?"
    So I click on "Locate". No help. I get a menu with folders that say "catroot" and other folders which names I cannot remember, but I scroll PAST the file folders, & it's just a bunch of ".DLL" files.....I don't understand what any of the names of the folders mean...it's frustr8ing-coz this is my 2nd iTouch, my 1st one got stolen & I can't afford2buy my music back at this time & i NEVER before had a single problem with losing song file locations.
                  Is there anyone out there who has been through this frustrating game of chasing your tail?....<that's how I feel>
    If so I would be ever so gr8ful if maybe someone with the knowledge would be so kind as 2 tell me how/where 2 retrieve these songs & how to put everything back where it belongs, I would be 4ever gr8ful !!!
    I can't afford 2 replace the songs just like I'm unable 2 buy back my old music from my stolen iTouch....man that was an awesome collection-someday I'll be able 2 afford 2 do that & I would like 2 have all the new music that I paid 4 but cannot find when I got my new iTouch....that would just be  wonderful.
                 I hope someone sees this post that can help me retrieve these files....losing $100.00 of iTunes is a REAL BUMMER!!!!!!
                                                      ThanQ SO very much!
                                                                             [email protected] or [email protected] or [email protected] .
                                                                                               You can also find me on Facebook, my given name is Tiffinie Trimmer, &
                                                                                                that's my Facebook "handle".    ThanQ 4 taking the time 2 read all of this!
                                                                                                hope 2 get a reply someday....I'll B checking all my emails & my Facebook, as well
                                                                                                as marking this page in my FAVORITES so I can find it fast! Take Care!!!

    I was not complete clear.
    Since you never changed the settings in the advanced section of iTunes preferecnes, you have to chech that your music is really in the location setted in the folders reported in the advanced section.  If not you have 2 ways: reset the position of this folders or in the actual disk organisation or in the pointing on the preferences.
    If you press the reset button you just give to itunes its default setting as for the position of the music files: probably this will be a good choice if you have never changed any default preference.
    But before I would check the folders and see if the songs are really there
    In my iTune I have this, and I believe it is the default.
    Users/YOURHOMEFOLDERNAME/Music/iTunes/iTunes Music

  • Exporting photos for UHDTV or Native 4K TV, what are the best settings ? (File: Quality File: Color Space, Image Sizing and resolution)   Or in other words; How can I get the smallest files but keep good quality for display on new UHDTV

    Exporting photos for UHDTV or Native 4K TV, what are the best settings ? (File: Quality File: Color Space, Image Sizing and resolution)   Or in other words; How can I get the smallest files but keep good quality for display on new UHDTV

    You're welcome, and thank you for the reply.
    2) Yesterday I made the subclips with the In-Out Points and Command-U, the benefit is that I've seen the clip before naming it. Now I'm using markers, it's benefit is that I can write comment and (the later) clip name at once, the drawback is that I have to view to the next shot's beginning before knowing what the shot contains.
    But now I found out that I can reconnect my clips independently to the format I converted the master clip to. I reconnected the media to the original AVI file and it worked, too! The more I work with, the more I'm sold on it... - although it doesn't seem to be able to read and use the date information within the DV AVI.
    1) Ok, I tried something similar within FCE. Just worked, but the file size still remains. Which codec settings should I use? Is the export to DV in MOV with a quality of 75% acceptable for both file size and quality? Or would be encoding as H.264 with best quality an option for archiving, knowing that I have to convert it back to DV if I (maybe) wan't to use it for editing later? Or anything else?
    Thank's in advance again,
    André

  • HT201317 When I view photos on my devices some are not oriented correctly. I used Picassa to turn all photos upright and then copied those photos into the upload file but they are still not corrected when viewed on my devices (ipads)

    When I view photos on my devices some are not oriented correctly. I used Picassa to turn all photos upright and then copied those photos into the upload file but they are still not corrected when viewed on my devices (ipads)

    Generally I would not use Facebook for sharing any photos, it compresses the photos substantially, and when you have shadows and dark colours you get visible "bands" where there should be subtle gradients, ie at sunsets and sunrises.
    It sounds like you are using two methods to upload to Facebook:
    1. Sharing from within Aperture, which basically syncs Facebook with your Aperture album, so any changes made at either end gets synced, hence the deletions from Albums, although the original file should still be in your library, just removed rom the album. It is like a playlist in iTunes.
    2. Exporting pics and uploading to Facebook from the browser.
    I am not sure how method 1 gets compressed, but I know that uploading hi-res jpegs to Facebook using method 2 results in poor quality images.
    I wouldn't even bother comparing option 1 or 2, and they will both be poor images once you view them on Facebook, as opposed to viewing uploaded images on proper image sharing / hosting sites.
    Your problem is not with Aperture, it is using Facebook for showing your work.
    If you export pics form Aperture at high res jpegs or TIFFs your images will be fine.
    If you insist to use Facebook as your way to share your work, then your workflow should be this:
    1. Right click images you want to share.
    2. Select Export version.
    3. Export as 100% size and ensure the export settings are set at 100% quality.
    4. Upload this pic into Facebook.
    This will get you the best image size and resolution on Facebook.
    See how you go.

  • Hi, l authorized my computer using iTunes and it said successful, but when l start syncing my applications l get this error: "The iPhone "My name" could not be synced because this computer is no longer authorized for purchased items that are on this phone

    hi, l authorized my computer using iTunes and it said successful, but when l start syncing my applications l get this error: "The iPhone "My name" could not be synced because this computer is no longer authorized for purchased items that are on this phone".
    May you help
    Thanks

    Try TS1389: iTunes repeatedly prompts to authorize computer to play iTunes Store purchases.
    tt2

  • Recently bought  a new computer and all my music appears in iTunes as well as on my computer in a saved folder. When I try to play the music in iTunes I get an error that reads"the song could not be used because the original file could not be found."

    Recently bought  a new computer and all my music appears in iTunes as well as on my computer in a saved folder. When I try to play the music in iTunes I get an error that reads"the song could not be used because the original file could not be found. Would you like to locate it?" Hope you can help me solve this issue.
    Thanks,
    Shellyboo

    This happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • When I load Illustrator creative suit (5.5) on my new computer, it loads Then I put in the serial number, which is correct, but when i go to click on the program to use it it says ERROR: localized resource file from this program could not be loaded. pleas

    When I load Illustrator creative suit (5.5) on my new computer, it loads Then I put in the serial number, which is correct, but when i go to click on the program to use it it says ERROR: localized resource file from this program could not be loaded. please re install of repair the application and try again. I have done this and it's still not working                  

    anomaly jade,
    You only need to use the serial number during installation.
    Have you, at least seemingly, been able to install, and then you are unable to start up?
    If that is the case, you could try to reinstall using the full three step way:
    Uninstall, run the Cleaner Tool, and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • In windows cmd lueo used \ \ server and get to the pc but mac as done

    in windows cmd lueo used \ \ server
    and get to the pc but mac as done

    Your question (if it is one) makes no sense whatever.
    Please describe your problem in greater detail, and include details of what Mac you have and what version of OS X.

  • HT1338 hi i am using mac os x 10.5.8 but this os is not supporting few software updates.so how can i get a better version of os?

    hi i am using mac os x 10.5.8 but this os is not supporting few software updates.so how can i get a better version of os?,,this os not supporting google chrome and i tunes 7..

    The next Mac OS version os 10.6.
    Below is a link to some details how you can obtain that for your Mac.
    https://discussions.apple.com/thread/4368218
    After you upgrade to 10.6 and update to 10.6.8 you can buy version 10.8 online at the Mac App Store.
    That will provide the basis for any of the latest software you now want.
    Message was edited by: roam

  • TS1814 I tried updating my iphone 4 using itunes but i keep getting a message saying iphone software server could not be contacted. What does this mean and how do I fix my iphone which appears to be in recovery mode.

    I tried updating my iphone 4 using itunes but i keep getting a message saying iphone software server could not be contacted. What does this mean and how do I fix my iphone which appears to be in recovery mode.

    USER-kswest wrote:
    BTW I have gone to the "Contact iTunes Support" and do NOT get anywhere. That is why I am here!
    You need to contact iTunes support and send an email by following the link I posted.
    Simply going there does nothing.

  • My PDFs with form fields get "There was an error opening this document. The file is damaged and could not be repaired." on anothers computer, PC and MAC

    Im creating PDFs through InDesign and using Acrobat Pro 9 to add fields.  I save them to allow ADobe Reader people to use them.  Everything works fine on Pro and Reader on my end with a PC as well as someone elses PC.  But one person using Mac said some forms work and some dont.  Those that dont get the error "There was an error opening this document. The file is damaged and could not be repaired."  Ive resaved them and made sure they work and same problem.  There is nothing overly coplex about the PDFs either, a date field at the most.  They are using Reader 9.1.
    I found out the other day that one person who can open them adds info to them saves them and send over to that other person and cannot open any of them after they have been edited, same error.  He even tried on a PC and still gets it.
    I dont know what to do.  I know it has to be on his end and not mine.  What else can I suggest to him??

    It sounds like they are using an earlier version of Acrobat or Reader, though you said Reader 9.1. If you add some features in AA9 that are new, it appears that earlier versions see the new features as damaged files. At least that is my guess. Try using Reduce File Size or PDF Optimize to save to an earlier version and see if that helps. The other option is that you are getting them messed up in e-mail because many client look at PDF files as ascii and do not encrypt them. In that case force the encryption. You can also send them in ZIP form.

  • When I try to open a pdf file I get the message, "The file is damaged and could not be repaired." I

    When I try to open a pdf file I get the message: "The file is damaged and could not be repaired." I've downloaded the latest reader, but that has made no difference. I use a Mac 10.8.2. Any suggestions or info?

    Does this happen with every PDF file or a specific one ? Maybe the file is really damaged.

  • TS2830 When I synch my  phone or other devices to itunes, I get a message that the following songs could not be synched to itunes because the file could not be converted. However, these are songs that I bought directly from Itunes.  Any suggestions?

    When I synch my  phone or other devices to itunes, I get a message that the following songs could not be synched to itunes because the file could not be converted. However, these are songs that I bought directly from Itunes.  Any suggestions?

    Hello rafagee,
    I understand that you are not able to sync a few songs you purchased from iTunes to your iPhone and other devices.  There may be an issue with the file, but if you have the Apple ID and password used to purchase the songs, you can redownload them.  You can even download the song directly to your iPhone.  I found an article that will give you steps to do this on your computer and on your iPhone:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/ht2519
    Thank you for posting in the Apple Support Communities.
    Best,
    Sheila M.

  • TS1814 I'm trying to update iTunes software, but when I go to Help/Check for updates, I continue to get the message: "The iTunes update server could not be contacted. Please check your Internet connection or try again later."  Is there another way to upda

    I'm trying to update iTunes software, but when I go to Help/Check for updates, I continue to get the message: "The iTunes update server could not be contacted. Please check your Internet connection or try again later."  Is there another way to update?

    Try updating using an iTunesSetup.exe (or iTunes64Setup.exe) installer file downloaded from the Apple website:
    http://www.apple.com/itunes/download/

  • When I attempt to open a PDF file I saved from a website, I get the message "There was an error opening this document. The file is damaged and could not be repaired." Is there any way to correct this problem?

    When I attempt to open a PDF file I saved from a website using Safari, I get the message "There was an error opening this document. The file is damaged and could not be repaired." When I save the same PDF file using FireFox it opens up immediately. Is there any way to correct this problem with Safari?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

Maybe you are looking for

  • Cookies (working with another application)

    Hello, I am currently working on a project. I finished everything in the project but there are many requests to bypass the login page. Currently users log on to a facutly site which then gives them the link to my application. The password for the fac

  • XP Activation with external Hd?

    I'm not sure where else to post this question. I have numerous PXI-8196 systems in the field that boot from an external SCSI disk (for security reasons). I initially configured them by creating a disk image of the internal HD (with XP already install

  • Dual G5 Doesn't see PB on Network

    My Dual G5 is connected via ethernet to a Linksys wireless router. My PB has an airport card in it. The PB can see the Dual G5 and transfer files using it as the control point. But the Dual G5 cannot see the PB. The Dual G5 does recognize the network

  • Syncing with a Palm Centro

    Not sure if this is the right section or not but I have going to have to switch cell phones. I currently have a Katana (with Sprint) and I want a cell phone that will sync with my Power Mac G4 Quicksilver. In looking at the list of Mac-compatible pho

  • Hi,  I don't really know wether I should post this message in the iPad sect

    Hi, I don't really know wether I should post this message in the iPad section or in this section... Anyway. Here is my problem : I would like to stream music from my iPad to my living room soundsystem, so I bought an Airport Express. BUT my router is