Reading filenames with characters other than a-z
Hi!
My problem is that I'm writing very simple integration that only transfers files around. Problem is that some directories and filenames have for example scandinavien characters.
Examples:
D:\lähtevä\lähtö.xml
Problem is that when I read files/directories via following code while in the D:\lähtevä folder:
File dir = new File(fname);
String[] chld = dir.list();
if(chld == null){
System.out.println("Specified directory does not exist or is not a directory.");
System.exit(0);
}else{
for(int i = 0; i < chld.length; i++){
String fileName = chld;
System.out.println(fileName);
variable "fname" would be "." given from command line when application starts up.
Result is that all "ä" letters become "Σ" characters. Other scandinavian letters are also messed up. I'm running on windows machine.
What is the correct way to read filenames so that their country-specific characters are not messed up?
Will this small test run correctly on your machine?
public class ReadingFilesWithNonASCIINames {
public static void main(String[] args) {
String dirPath = "E:/lähtevä";
String fName = "lähtö.txt";
File directory = new File(dirPath);
assert directory.exists();
File file = new File(directory, fName);
assert file.exists();
//Now try to read it
try {
FileReader reader = new FileReader(file);
int c;
while((c = reader.read()) != -1) {
System.out.print((char)c);
} catch (IOException e) {
e.printStackTrace();
}Compile it and run it with -ea flag. On my machine it ran without any problems (Windows XP, BE/fr locale, default encoding for files: System default -- windows-1252)
Similar Messages
-
Language: Filename with characters for arabic turns question mark
Language: Filename with characters for arabic turns question mark
OS: Solaris 9
Machine: Sun-Fire 25K
There is an adobe distiller software that is configured and a java apps. There are postscript files that are being converted to .pdf format using the adobe distiller. Using the GUI (using the Exceed; for remote access), when they use GUI to convert the postscripts to pdf files, the long filenames have the corresponding characters for arabic reading purpose. This is OK.
When we use the windows RUN to telnet the server and convert the postscripts to pdf, it gives a question marks characters in the filenames ( this; is a sample; filename; ?? ??? ??; right.pdf )
We are not sure now if we have to add a package of arabic or a patch to resolve this problem.
Message was edited by:
yurioira32
Message was edited by:
yurioira32Solution found, I'll post the work around to those who might encounter the same problem.
Somewhere in the layers of technology (webwork or weblogic I'd guess), the servlet response is encoded into UTF-8 regardless. The encoding in the database was ISO-8859-1. Sending ISO encoded bytes by UTF-8 caused the conflicting character codes (anything above 127) to show up as undefined.
The fix is to decode the input byte array into ISO-8859 string, then encode that string into UTF-8, which can be send by Weblogic.
isoConvert = new String(buf, "ISO-8859-1");
out.write(isoConvert.getBytes("UTF-8"), 0, isoConvert.getBytes("UTF-8").length); -
does ipad mini have a usb port? if not then how can i share my documents with devices other than apple?
Wireless Flash Drive (tap to enlarge image)
-
"I am trying to sync my phone calendar with anything other than outlook. can anyone help???
hello,
if you look at the Desktop Software page on the blackberry.com website, there is a section called "requirements" and in that section you have a paragraph with the list of PC software against which you can do a synchronization.
apart from PC software, you can also synchronize with GMail Contacts, Google Calendar, Yahoo!Mail and probably some other like facebook contacts, facebook events.
The search box on top-right of this page is your true friend, and the public Knowledge Base too: -
(261718088) Q: Can you use xm:multiple with Objects other than String?
Q: Can you use xm:multiple with Objects other than Strings?
<br>
A: You bet. Attached find a text file with some code from the example I showed
today, a version of the multipleSayHiTo() method that has a parameter of an Array
of Person objects rather than a parameter of an Array of Strings. The code within
the text file comes from the Greeting.jws file (the Greeting Web Service).
[multiple.txt]So you are saying that the recovery discs I made do include the copy of windows that was originally installed?
Absolutely! They will restore the hard disk to its original out-of-the-box contents. Follow the instructions in the section Restoring from recovery DVDs/media, which begins on p. 73 of the User's Guide.
Satellite A660 Series User’s Guide
maybe i can make a deal with wd to have them swap this drive out for the BEKT instead...
That would be a good idea in any case.
As I said, the 10-fc12-045d error would not be due to the drive's being AFT, but more likely the discs are not being read properly. New discs can be obtained from Toshiba. Scroll down to Get Recovery Media here
-Jerry -
How do i install reader to a drive other than the boot drive?
how do i install reader to a drive other than the boot drive?
Hi nicksdaddy,
There is an offline version:
http://get.adobe.com/reader/enterprise/
Hope that helps!
Stacy -
Can I install Adobe Reader to a drive other than the C: drive?
Can I install Adobe Reader to a drive other than the C: drive?
Hello there,
Welcome to Adobe Community. Yes it can be installed on a different drive. Though some of the files installed by it will still be installed on C: drive.
When you run the installer, use 'Change destination folder' at the bottom of the panel
If you already have Adobe Reader installed on the C: drive, you must uninstall it before installing a new version on a different location.
Thanks! -
Can I instal Reader to a drive other than C:?
Is someone able to tell me how to instal Reader to a drive other than C:?
I am trying to free up space on C: and prefer to load the Reader files into another drive, but I did not see an option to do that when downloading, and the installer just starts automatically without prompting for a target folder.Use the offline installer from http://get.adobe.com/reader/enterprise/ and click on Change Destination Folder
-
The document contains no posting lines with value other than zero
Hi!
We are having problems posting a invoice in MIRO. When entering the PO number we receive the error message "The document contains no posting lines with value other than zero".
What could be the problem?
/AndersHi!
The GR_BASEDIV is set in the PO. The PO is replicated from SRM where this flag has been set for no reason. Only GR and IV are set and we have implemented a note 1155266 so that Confirmation-Related IV will not be set.
How come it is set anyway?
Sincerely
Anders -
Can the voiceover utility on the 6th gen Nano be accessed with headphones other than the Apple earphones?
No I have tried and they don't also my iPod touch 2nd generation doesn't work with voice control unless it has apple earbuds plugged in. I guess apple doesn't want 3rd party brads interfering with their company. Thanks please like
-
How can I get a Macbook (pro) with numpad other than buying a second handed
Actually,
I am currently using a Macbook (2,1)
and i bought it because i thought i had a low demand of graphics, displays, etc.
And i planned to buy a Macbook Pro in several years.
However,
after MONTHS,
Apple Inc, kills numpad, and i was totally shocked and keep searching for any manufacturer or Apple Inc. itself would allow special hardware request.
By the way.
what is "full sized keyboard" actually means?
does it mean just the qwerty keyboard?
I was really disappointed with the new keyboard design.
I believed some of the mac users did the same.i really hope someone could and i know you understand numpad is numpad, not just numbers.
i think if the people in the design group or whatever name it is, do use the numpad, or understand how i numpad would actually affect some of the people. apple inc would just keep it.
maybe you'll say.
"oh well, time passes. several years later, numpad will be totally illuminated. we are actually making trend of the computer technology!"
but then so you mean you can actually cut the fn key, change the arrow keys, etc.
its kind of sad.
i knew you understand.
like the new keyboards has those fastforward, play, rewind keys.
but those are actually optional you can still set universal hot keys if they are eluminated, and also our beloved apple remote did the same (i mean the ones we are now having)
however numpad is compulsory functional in some extent, there is no way to access numpad other than using the "Keyboard Viewer".((**slowly clicking**))
and i believed some of the businessman demand them so well.
why people just cant leave windows?
its all about compatibility.
applications are more and more made for mac.
but now we have some awkward jagged decision made here just now.
numpad is kind of the vital function to like at least 10% of the people in the world who use computers.
there is only one reason i can think of if you say so.
maybe that is a strategy to keep Mac computers up high in the sky,
so they, oops, cut users by cutting numpad incidentally. -
Can you load songs with anything other than iTunes?
I'm trying to re-install itunes after my PC collapse, but I can't and I really want to upload new music to my ipod, but I can't, can I use any other software other than iTunes? Cuz seriously, I don't know what's the problem with iTunes, but I can't install it.
There is a lot of software for iPods that allow you to transfer music and more.
There are things like anapod (http://www.redchairsoftware.com/anapod/featpw.php), ephpod (http://www.ephpod.com/), podplus(http://www.ipodsoft.com/index.php?/software/podplus),and even a winamp extension (http://www.mlipod.com/).
They aren't hard to find, just search. -
Since downloading FF4 to replace 3.1.6 I cannot get the Toolbar other than by pressing the Alt button and whilst this shows the toolbar it will not stay. I have followed the Firefox instructions, other than opening in Safe Mode which it will not do either ,none of which have cured the problem. I am using Vista, with Trend Anti Virus and also have IE8 which is working OK.
Hi collizz, welcome to the forum,
if you have access to another computer I suggest you download Kaspersky Rescue Disc and create a bootable cd, below is a link to a knowledgebase article where you can download it and also find out how to use it.
http://support.kaspersky.com/faq/?qid=208282173
Good luck.
p.s. moving to Security and Malware board.
Andy ______________________________________
Please remember to come back and mark the post that you feel solved your question as the solution, it earns the member + points
Did you find a post helpfull? You can thank the member by clicking on the star to the left awarding them Kudos Please add your type, model number and OS to your signature, it helps to help you. Forum Search Option T430 2347-G7U W8 x64, Yoga 10 HD+, Tablet 1838-2BG, T61p 6460-67G W7 x64, T43p 2668-G2G XP, T23 2647-9LG XP, plus a few more. FYI Unsolicited Personal Messages will be ignored.
Deutsche Community Comunidad en Español English Community Русскоязычное Сообщество
PepperonI blog -
If I try to log into my application through anything other than Firefox I get the following message on the screen:
Error
Error processing request.
ORA-06502: PL/SQL: numeric or value error
OK
If I try to access the APEX Builder through a browser other than Firefox, I get no HTML returned.
Last night I upgraded from 4.1 to 4.2.2 and ran the patch that dealt with missing developer toolbars...
Of course, I only ever use Firefox, but my users are using IE...
Any ideas?
Message was edited by: AndyH
Clarified that this is a 4.2.2 issue.Hi,
I do not know if this relating bug 16760897
Oracle Application Express 4.2.2 - Known Issues
Regards,
Jari -
Inbound Processing of Idocs with status other than success
Hi,
I am new to ALE/Idocs. Can anyone please let me know how can I process the Idocs which have the status other than 53.
Thanks & Regards,
IndiraHi,
In addition to the previous posts few more programs to process failed inbound IDocs are as mentioned below.
- Use program RBDAGAIE to process edited IDocs (IDocs with status 69)
- Use program RBDAPP01 to process IDocs failing with serialization issue (IDocs with status 66)
- Use program RBDAGAI2 to process IDocs after ALE inbound error (IDocs with status 56, 61, 63, 65)
~ Bineah
Maybe you are looking for
-
Error while creating PO for Asset is investment measure
Hi All, I am getting error when I try to create PO for Asset which is investment measure. Error is as below:- Asset is investment measure, transaction type not allowed Message no. AK005 Diagnosis Asset 305000003 0 that is to be posted is an investmen
-
BAPI o FM for posting goods receipt of an inbound delivery
Hi I have a program that post a goods receipt for an inbound delivery using batch input of transaction VL32 (in the first screen of this trx pushing button "Post Goods Recepit"). We need to change it for a BAPI o FM that makes the same process. I'
-
Incorrect SELECT statement with single quotes
I am getting the following error trying to select a value from a database: SQLException caught: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'mod='Payroll''. Couldn't load driver:[Microsoft][ODBC Micro
-
How can I batch save my adjusted raw images as jpgs in Lightroom 4
I have a job that I imported to Lightroom 4. I made adjustments to 40 of the images and would like to batch save these as jpgs with the LR adjustments saved. So far I know I can save the raws as jpgs but the adjustments are not being saved. I woul
-
My Mac Book Air has developed an erratic process with the track pad. Sometimes the page scrolls without touching the pad, great chunks of my Thesis can be highlighted and sometimes I delete without realising. Does anyone else have this problem. The T