I have a Java program, reading a file (which has characters from a native language), and populating a string. It works fine, when program is run directly.
But when same program is invoked from Python then its not able to populate the string.
public static void main(String[] args) {
File inputFile = new File("input.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile),"UTF-8"));
string output = "";
while ((line = br.readLine()) != null) {
// This block never hits when invoked by python. It works fine when java program runs directly.
output +=line+" ";
}
...
}
From Python I am invoking it as following
cmd = ['java', java_class]
subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
Any inputs? btw I am using Atom IDE, not sure if that makes any difference.