When you want to work with files in JAVA, You must know the encoding of files.

Default encoding system in Farsi windows is cp1256.

1-What is the relationship between ANSI and cp1256?
2- Does JAVA support ANSI?

My guess is that ansi and cp1252 are the same. But i’m not positive.

Here is a link that describes ansi:

It does make reference to windows-1252 but not cp1252.

Here is a small program that will display all the character sets available to you.

import java.nio.charset.Charset;
import java.util.Map;
import java.util.Set;

public class ListCharacterSets {
	public static void main(String[] args) {
		Map<String, Charset> charsetMap = Charset.availableCharsets();
		Set<String> keyset = charsetMap.keySet();
		for(String key : keyset) {
			Charset charset = charsetMap.get(key);

BTW, go buy the Java Internationalization book. It will help you with all these questions you’re having on character sets.

Internationalization is a tough topic and not widely understood completely. That book though, is quite good.