Encryption Issues with UTF-8 in Havana

Libraski

New member
Hey everyone,
I'm currently trying to set up a custom server with Havana, and I’m running into a weird issue with the encryption system.


Whenever I send messages that include special characters like ä, ö, ü, ß, the message gets cut off or the client freezes completely.

For example, if I write "täst", only "tä" shows up. If I send longer UTF-8 texts, the whole client crashes or disconnects silently.


I'm using the original Cryptography.java and everything is still in its default state (I didn't modify anything important). I tried to understand what's going wrong with the help of ChatGPT, but since I don't have much programming experience, it's hard for me to fully fix it myself.


So I'm hoping someone here might understand the internals of Havana's encryption system and could explain what’s causing this or how to properly handle UTF-8 in this setup.


Thanks a lot in advance 🙏
 
Please try with Havana 1.3
I am using Havana 1.3, but it doesn't work. I'm not sure if it's an issue with Havana itself, the database, or the DCR. ChatGPT told me it might be a problem with how the bytes are handled. Here's what it said:


If StringUtil.getCharset() does not return UTF-8, then special characters like Umlauts may be misinterpreted during conversion — leading to corrupted or unreadable text (e.g., � or strange symbols).

- The Umlaut ä in UTF-8 is encoded as 0xC3 0xA4
- In ISO-8859-1, it's 0xE4
- So if you're decoding bytes with the wrong charset, you end up with incorrect characters.

The problem is, I don't have enough programming knowledge to fully understand or fix this on my own 😅

If anyone knows how to solve this or where exactly I need to set UTF-8 in Havana or the client, I'd really appreciate the help!
 
Hey, thanks a lot for updating the charset to UTF-8! That really makes sense and probably fixes some stuff where StringUtil.getCharset() is used.

But yeah, I still get the same problem with messages being cut off - like if I send "täst", it still ends up as just "tä" on the server. And sometimes when I type longer stuff, the client kinda freezes or crashes.

From what I could figure out (with a bit of help from AI haha), I think the main issue might be in the encryption part. It’s working with Java String and char, but UTF-8 characters sometimes take more than 1 byte - so I guess it messes up when the encrypted stuff is handled like 1 char = 1 byte.

I’m not a real dev so I don’t fully understand everything, but I just wanted to share what I’m seeing in case it helps. Maybe the encryption would need to work with byte[] directly instead of Strings?

Anyway, thanks again for your time and for helping me out with this 😊
 
Back
Top