The Artima Developer Community
Sponsored Link

Java Answers Forum
ISO-8859-1

1 reply on 1 page. Most recent reply: Mar 20, 2006 4:31 PM by John Sjöberg

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Shelley Stone

Posts: 1
Nickname: shelley
Registered: Mar, 2006

ISO-8859-1 Posted: Mar 14, 2006 1:51 PM
Reply to this message Reply
Advertisement
I am using Java to test requirements for data within files.
I am using the below code to verify ISO-8859-1 compliance within the files. The code is not really checking for ISO-8859-1 and the IOException e error comes up everytime. The UnsupportedEncodeingException is not even working at all.

What I would like it to do is tell me if there are any characters within the file that DO NOT meet ISO-8859-1. Could someone please help me?

try {
BufferedReader in = new BufferedReader(
new InputStreamReader(new FileInputStream
"infilename"), "8859_1"));
String str = in.readLine();
} catch (UnsupportedEncodingException e) {
System.out.println ("Code is not 8859-1 compliant " + e);
} catch (IOException e) {
System.out.println ("Code is not 8859-1 compliant " + e + " !!!The system cannot find NB1!!!");
}
Shelley


John Sjöberg

Posts: 2
Nickname: flaco
Registered: Mar, 2006

Re: ISO-8859-1 Posted: Mar 20, 2006 4:31 PM
Reply to this message Reply
UnsupportedEncodingException will only be raised if the encoding you choose isn't supported (i.e. ISO-8859-1).

Furthermore, I do not think that you can say that a text is not ISO-8859-1 compliant. You could probably check to see if there are many "strange" characters read.

Telling the stream that it should decode the data as ISO-8859-1, well then it does, and it will be valid.

An article on the encoding topic: http://www.joelonsoftware.com/articles/Unicode.html

Flat View: This topic has 1 reply on 1 page
Topic: Soap Message in Java Previous Topic   Next Topic Topic: parametrized types (again)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use