Umlaute is an Invalid character constant?

I am checking if there are some Umlaute in my text. The error message is “Invalid character constant”

```
if (text.charAt(0) == 'ä') println("Hallo");
```

The same happens IMHO with every char above #127. This only happens in Processing. In pure java it works as it should.

Mit herzlichen Grüßen

Uli

Hello @u.strautz,

Welcome!

It works with Processing 4.4.10 on W10:

Also works with Processing 4.5.2 on W10.

Can you please provide some details:

  • Processing version
  • Operating system
  • An MCVE for us to try.
    This can help narrow it down.
    Sometimes it is the renderer or something else in the code.

More on MCVE here:
Guidelines—Asking Questions

:)

I use W11 & Processing 4.5.2

The IA said I should check the coding. I did and it is UTF-8 w/o BOM

If the only Tab is…

void setup() {
size(400, 400);
}

void draw() {
String text = “äbc”;
if (text.charAt(0)== ‘ä’) println(“Hallo”);
}

it works just fine.
The trouble begins, when I have a second tab (StringInt.java). Now the error pops up.

public class StringInt {

} // end of class StringInt 

So it has something to do with regular java classes. I need them to experience private procedures and variables in class. (encapsulation)

Gruß, Uli

1 Like