Problem with quotations in Strings in Intellij
I've been trying to check if strings of a
linkedlist contain these fancy double quotations ( “ ) with this code:
FileParser parser = new FileParser("C:\\Users\\_Farzad_\\Desktop\\Contents___.xml");
LinkedList<String> list = parser.xmlParserFromFile();
System.out.println(list.get(0));
String string = list.get(0);
System.out.println(string.charAt(43));
System.out.println( string.contains("“"));
String s = "Zott, Christopher, and Raphael Amit. 2007. “Business Model Design and the Performance of Entrepreneurial Firms.” Organization Science 18(2):181–99. ";
System.out.println(s.contains("“"));
but the program output was :
Zott, Christopher, and Raphael Amit. 2007. “Business Model Design and the Performance of Entrepreneurial Firms.” Organization Science 18(2):181–99.
“
false
true
the problem was that I've just copy/pasted the console output to initialize String s , but the result of method contatins() was changed!
I've tried it in eclipse and it worked well. I think it might be a bug somewhere in intellij. I'm using community version 14.1.
I would appreciate if you check it and tell me what the problem is.
Regards
请先登录再写评论。
May be related to your encoding settings, see http://blogs.jetbrains.com/idea/2013/03/use-the-utf-8-luke-file-encodings-in-intellij-idea/ .
Thanks for your answere, But I couldn't find out where the problem is. If you don't have the same problem with the quotation character please tell me about the encoding you use.
Regards
Share a complete project to reproduce it and I'll try to help.