intellij idea - Java - duplicate case label -
i found time ago function replace polish characters in text "normal" version of character. used in projects earlier without problems, now, when copied it, doesn't want work. when try compile old projects in same ide(intellij idea 14.1.3) ok, in new project it's giving me errors:
error:(22, 17) java: duplicate case label
it happens each case except first , default. function code:
public static string polskieznaki(string s) { char[] tekst = s.tochararray(); s = ""; for(int i=0; i<tekst.length; i++) { switch(tekst[i]) { case 'ą': tekst[i] = 'a'; break; case 'ć': tekst[i] = 'c'; break; case 'ę': tekst[i] = 'e'; break; case 'ó': tekst[i] = 'o'; break; case 'ś': tekst[i] = 's'; break; case 'ł': tekst[i] = 'l'; break; case 'ż': tekst[i] = 'z'; break; case 'ź': tekst[i] = 'z'; break; case 'ń': tekst[i] = 'n'; break; case 'Ą': tekst[i] = 'a'; break; case 'Ć': tekst[i] = 'c'; break; case 'Ę': tekst[i] = 'e'; break; case 'Ó': tekst[i] = 'o'; break; case 'Ś': tekst[i] = 's'; break; case 'Ł': tekst[i] = 'l'; break; case 'Ż': tekst[i] = 'z'; break; case 'Ź': tekst[i] = 'z'; break; case 'Ń': tekst[i] = 'n'; break; default: break; } s += tekst[i]; } return s; }
i grateful help.
thanks makoto's comment, set default encoding of particular file (not ide , project encoding) utf-8 , fixed problem.
Comments
Post a Comment