UTF-8 locale in RPM build

Mattias Ellert mattias.ellert at fysast.uu.se
Mon Aug 26 03:10:16 UTC 2013


sön 2013-08-25 klockan 23:13 +0200 skrev puntogil at libero.it:
> Il 25/08/2013 22:17, Ian Pilcher ha scritto:
> > I'm trying to build a jpackage SRPM (jena-iri) on Fedora 19, and it's
> > failing, because the locale (LANG) is apparently set to "C" during the
> > build.  (javac and javadoc don't like non-ASCII characters in source
> > files in an ASCII locale.)
> >
> > What's the best way to set it to a UTF-8?  (Should I just add "export
> > LANG=en_US.UTF-8" to the relevant sections of the SPEC file?)
> >
> > Thanks!
> >
> hi
> convert the sources code wiith non-ASCII characters with
> native2ascii
> e.g.
> native2ascii -encoding UTF8 A.java A.java
> regards

In almost all cases converting to ascii is not an acceptable solution.
Not only for java source but for any text. Blindly converting java
sources to ascii can introduce bugs, since - unlike C and C++ - you are
allowed to use non-ascii characters in variable names and other
identifiers in java sources. Even if non-ascii characters are only
present in comments, those may end up in the javadoc documentation, so
converting to ascii is likely to introduce documentation bugs.

Better fix the broken build instructions to correctly state what
encoding is used by the project. E.g. by adding

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

to the pom-file, or add -Dproject.build.sourceEncoding=UTF-8 to the
build on the command line.

	Mattias


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4575 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20130826/3f607054/attachment-0001.bin>


More information about the devel mailing list