You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Raffaele <r....@prismasw.it> on 2007/10/26 11:44:54 UTC

Re: maven.compile.encoding problem (?)

I have the same problem!

Modifying the java sources putting direclty the unicode string IS NOT A
CLEVER SOLUTION.

Any other hints?

Thanks and best regards.
Raffaele



Luca Gmail wrote:
> 
> The file is the same :)
> 
> 
> 
> Tnx for your answer.
> 
> 
> On 6/19/06, Thorsten Heit <th...@xtramind.com> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi Luca,
>>
>> > when i try to compile my project i have this error :
>> >
>> > duplicate case label error.
>> >
>> > Below the code where the error is raised:
>> >
>> > for (int i = 0; i < n; i++) {
>> >
>> >          char c = s.charAt(i);
>> >
>> >          switch (c) {
>> >
>> >             case '<': sb.append("&lt;"); break;
>> >
>> >             case '>': sb.append("&gt;"); break;
>> >
>> >             case '&': sb.append("&amp;"); break;
>> >
>> >             case '"': sb.append("&quot;"); break;
>> >
>> >             case 'à': sb.append("&agrave;");break;
>> >
>> >             case 'À': sb.append("&Agrave;");break;
>> >
>> >             case 'â': sb.append("&acirc;");break;
>> >
>> >             case 'Â': sb.append("&Acirc;");break;
>> >
>> >             case 'ä': sb.append("&auml;");break;
>> >
>> >             case 'Ä': sb.append("&Auml;");break;
>> >
>> >             case 'å': sb.append("&aring;");break;
>> >
>> >             case 'Å': sb.append("&Aring;");break;
>> >
>> >             case 'æ': sb.append("&aelig;");break;
>> >
>> >             case 'Æ': sb.append("&AElig;");break;
>> >
>> >             case 'ç': sb.append("&ccedil;");break;
>> >
>> > …
>> >
>> >
>> >
>> > In all the line.
>> >
>> > I compiled in windows machine and all works fine.
>> >
>> > I try ti compile in my linux machine and I have that error.
>>
>> That's a simple encoding problem in source code files - you're using
>> non-ASCII characters in the above Java code... (have a look into your
>> file on a Windows machine and then on a Linux box; it probably looks
>> different)
>>
>> If you really have to use non-ASCII characters in a text file
>> (properties file, Java source code etc.), you'd better use unicode
>> notation instead (\u00E6 for "æ"  etc.).
>>
>>
>> HTH
>>
>> Thorsten
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.3 (MingW32)
>>
>> iD8DBQFElqUbQvObkgCcDe0RAteCAKCowelIRFulB1FgK28SK4ZY1IUaYwCfRKAT
>> X4JHDYpMoeKB54pS12C30Kc=
>> =TonV
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/maven.compile.encoding-problem-%28-%29-tf1811337s177.html#a13423901
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven.compile.encoding problem (?)

Posted by Heinrich Nirschl <he...@gmail.com>.
Find out which character encoding is used by your Java source files
and set a matching encoding for the compiler. The description of the
compile plugin may help:
http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#encoding

As already mentioned, you can avoid all these encoding problems by
sticking to ASCII encoding and using unicode escapes in the source
where necessary.

On 10/26/07, Raffaele <r....@prismasw.it> wrote:
>
> I have the same problem!
>
> Modifying the java sources putting direclty the unicode string IS NOT A
> CLEVER SOLUTION.
>
> Any other hints?
>
> Thanks and best regards.
> Raffaele
>
>
>
> Luca Gmail wrote:
> >
> > The file is the same :)
> >
> >
> >
> > Tnx for your answer.
> >
> >
> > On 6/19/06, Thorsten Heit <th...@xtramind.com> wrote:
> >>
> >> -----BEGIN PGP SIGNED MESSAGE-----
> >> Hash: SHA1
> >>
> >> Hi Luca,
> >>
> >> > when i try to compile my project i have this error :
> >> >
> >> > duplicate case label error.
> >> >
> >> > Below the code where the error is raised:
> >> >
> >> > for (int i = 0; i < n; i++) {
> >> >
> >> >          char c = s.charAt(i);
> >> >
> >> >          switch (c) {
> >> >
> >> >             case '<': sb.append("&lt;"); break;
> >> >
> >> >             case '>': sb.append("&gt;"); break;
> >> >
> >> >             case '&': sb.append("&amp;"); break;
> >> >
> >> >             case '"': sb.append("&quot;"); break;
> >> >
> >> >             case 'à': sb.append("&agrave;");break;
> >> >
> >> >             case 'À': sb.append("&Agrave;");break;
> >> >
> >> >             case 'â': sb.append("&acirc;");break;
> >> >
> >> >             case 'Â': sb.append("&Acirc;");break;
> >> >
> >> >             case 'ä': sb.append("&auml;");break;
> >> >
> >> >             case 'Ä': sb.append("&Auml;");break;
> >> >
> >> >             case 'å': sb.append("&aring;");break;
> >> >
> >> >             case 'Å': sb.append("&Aring;");break;
> >> >
> >> >             case 'æ': sb.append("&aelig;");break;
> >> >
> >> >             case 'Æ': sb.append("&AElig;");break;
> >> >
> >> >             case 'ç': sb.append("&ccedil;");break;
> >> >
> >> > …
> >> >
> >> >
> >> >
> >> > In all the line.
> >> >
> >> > I compiled in windows machine and all works fine.
> >> >
> >> > I try ti compile in my linux machine and I have that error.
> >>
> >> That's a simple encoding problem in source code files - you're using
> >> non-ASCII characters in the above Java code... (have a look into your
> >> file on a Windows machine and then on a Linux box; it probably looks
> >> different)
> >>
> >> If you really have to use non-ASCII characters in a text file
> >> (properties file, Java source code etc.), you'd better use unicode
> >> notation instead (\u00E6 for "æ"  etc.).
> >>
> >>
> >> HTH
> >>
> >> Thorsten
> >> -----BEGIN PGP SIGNATURE-----
> >> Version: GnuPG v1.4.3 (MingW32)
> >>
> >> iD8DBQFElqUbQvObkgCcDe0RAteCAKCowelIRFulB1FgK28SK4ZY1IUaYwCfRKAT
> >> X4JHDYpMoeKB54pS12C30Kc=
> >> =TonV
> >> -----END PGP SIGNATURE-----
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/maven.compile.encoding-problem-%28-%29-tf1811337s177.html#a13423901
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org