Onslow McCann wrote: I have made a working program which reads in a Questionaire file and converts it to a descriptions file for coding open answers.
The problem is that sometimes the Questionaire is in UTF-16 other times UTF-8.
I've "fixed" the problem by promting for a user input in a JTextField of either String UTF = 8 or 16.
As it is now, I input the 8 first. If the program fails I then try the 16.
fis = new BufferedReader(new InputStreamReader(new FileInputStream(inFile), "UTF-" + UTF));
I'd prefer it if the program could recognize the correct file format for me but I can't work out how to do this.
Can anyone give me some hints?
Onslow McCann wrote:Thankyou Paul for the fast reply.
I'm attempting option 1, but can't seem to locate the files I need.
import org.mozilla.universalchardet.UniversalDetector;
I believe what I need to do is to make a map structure in my own source map org\mozilla\universalchardet\UniversalDetector?
And then put some files in the UniversalDetector map? Is that correct?
Onslow McCann wrote:I've downloaded "juniversalchardet-1.0.3.jar" to my C:\Program Files\Java\jre6\lib
Onslow McCann wrote:I've added it to my PATH variable
C:\Program Files\Java\jdk1.6.0_23\bin;C:\mysql-connector-java-5.1.6\mysql-connector-java-5.1.6-bin.jar;C:\Program Files\Java\jre6\lib\juniversalchardet-1.0.3.jar
Onslow McCann wrote:But when I compile it doesn't recognize the UniversalDetector class..
UniversalDetector detector = new UniversalDetector(null);
I once met a man from Nantucket. He had a tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|