I'm using netbeans, so I can't help there much. Here's IntelliJ's help page which you may already have seen:
https://www.jetbrains.com/help/idea/encoding.html

To be 100% sure of what's in your file, open it with NOTEPAD++ and use the hex plugin, or a hex editor. NOTEPAD++ also offers the feature to add a BOM to the file (if it isn't there). Assuming that this is correct, are you using maven? If yes, then the maven-compiler-plugin should look somewhat like this:

            <plugin>
<artifactId>maven-compiler-plugin</artifactId>
                <configuration>
<showDeprecation>true</showDeprecation>
                    <target>17</target>
                    <source>17</source>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

If you're not using maven, then look here:
https://stackoverflow.com/questions/43405266/ant-with-intellij-idea-encoding-problems
https://stackoverflow.com/questions/48206942/intellij-uses-wrong-encoding

If you still can't get it to run and nobody else answers here, ask on stackoverflow...

Tilman

On 31.01.2024 03:15, Gino G wrote:
Thanks for the reply Tilman.

Yes, you are right, I am indeed getting 8, and not 4.

However, I've been trying to change the encoding for almost two hours now,
with no effect.
Would you happen to know any resources that can help me get this to work?

For more reference, I'm using IntelliJ and all files in my project display
"UTF-8".
I'm using the Javac compiler using version 17 without command line
parameters.
However, I've tried setting things like: encoding=UTF-8, etc. with no
success.

If this solved my issue, that would be amazing, but unfortunately I can't
get it to work.

On 2024/01/30 16:01:56 Tilman Hausherr wrote:
Also try changing the line

     cs.showText("äöüß");

to

     String s = "äöüß";
     System.out.println(s.length());
     cs.showText(s);

the output on the console should be 4. If suspect your output will be 8
if my theory is correct.

Tilman




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to