Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabling UTF-8 encoding for clojure source files

I'm working on a project which involves maven, java and clojure. The problem I'm facing is this, I have some UTF-8 chars in my clojure source files because of which my source code is not interpreted correctly by the java compiler, I kinda got it working by setting the environment variable JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8, but what I want is to pass this property through MAVEN.

I have already tried setting MAVEN_OPTS=-Dfile.encoding but this doesn't seem to work.
I have also tried setting configuration for the compiler plugin of maven... something like this:

 <configuration>
        <compilerArgument>-Dfile.encoding=UTF8</compilerArgument>
 </configuration>

This doesn't work either.

I'm I doing something wrong, or is there another way.

thanks,
RD

Ok, Here's some more detail. This is my parent pom,

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <source>1.5</source>
      <target>1.5</target>
      <encoding>UTF-8</encoding> <! also tried <encoding>UTF8</encoding>
    </configuration>
  </plugin>

Nothing interesting in the child's pom except...

<resources>
  <resource>
    <directory>src/main/clojure</directory>
  </resource>
</resources>

;; clojure code snippet which causes problems

(let [char "대"]
   (not (empty? (filter #(s/contains? % char) <some-list>)))
;; The list is always empty because I never find a match if I do not set the env. variable
like image 356
RD. Avatar asked Sep 16 '09 04:09

RD.


People also ask

How do I change my encoding to UTF-8?

UTF-8 Encoding in Notepad (Windows)Click File in the top-left corner of your screen. In the dialog which appears, select the following options: In the "Save as type" drop-down, select All Files. In the "Encoding" drop-down, select UTF-8.

How do I convert a file to UTF-8?

Click Tools, then select Web options. Go to the Encoding tab. In the dropdown for Save this document as: choose Unicode (UTF-8). Click Ok.

Is UTF-8 the default encoding?

Show activity on this post. The way I read the spec, UTF-8 is not the default encoding in an XML declaration. It is only the default encoding "for an entity which begins with neither a Byte Order Mark nor an encoding declaration".


1 Answers

Did you try passing compiler options? [-encoding UTF-8]

like image 172
alphazero Avatar answered Oct 30 '22 10:10

alphazero