Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Special characters

A topic by Petzi created Mar 14, 2019 Views: 428 Replies: 4
Viewing posts 1 to 5
(1 edit)

Hey, I'm using TJSON for my master's thesis and I'm having issues when using strings with special characters (áàâãéêúíóõôç). When I encode (and then decode) them, they seem to get messed up ("salmão" gets drawn as "salm") but the strings are drawn normally when I don't encode+decode them with TJSON. It's not just when drawing, it happens any time I use TJSON on a string.

Any ideas on how I could prevent this? If necessary, I could probably get away with converting them to ASCII, turning "salmão" into "salm~ao" and then converting back, but I'd prefer to avoid that sort of hack, of course. Thanks a lot.

EDIT: I should mention that I'm using GameMaker: Studio 1.4.9999


I'll take a look but not entirely sure what's up - TJSON is specifically written with UTF-8 support, and would successfully display non-English names in Nuclear Throne.

If this is not as simple as tj_encode-ing a string and then tj_decode-ing it back to find it messed up, please provide a sample snippet that breaks it.

(3 edits)

Here's a small example. If you run this in a Draw Event, you'll notice that the black words look correct, while the red ones only show a part of the word correctly. It seems that tj_encode() is to blame.

var obj = tj_object("salmão", "Cátia");
var xx = room_width/2;
var yy = 100;
draw_text(xx, yy, "salmão");
draw_text(xx, yy+50, "calças");
draw_text(xx, yy+100, "Nazaré");
draw_text(xx, yy+150, tj_encode("salmão"));
draw_text(xx, yy+200, tj_decode(tj_encode("salmão")));
draw_text(xx, yy+250, tj_decode(tj_encode("calças")));
draw_text(xx, yy+300, tj_decode(tj_encode("Nazaré")));
draw_text(xx, yy+350, tj_get(obj, "salmão"));
draw_text(xx, yy+400, tj_encode(obj));

By the way, I was able to circumvent the problem with that trick I mentioned, so I don't have any urgency in getting this fixed. Let me know if I can help further!

EDIT: I tested with some Japanese characters and they also disappeared. However, I tested tj_encode("вадим") and it displayed "2048<" with the quotes included.


This is fixed in the new version (sorry for slight delay - I also had to figure out how to update the marketplace version)


Great, thanks a lot! This extension is really handy.
I'll also take this opportunity to say I've read your blog for years now! Thank you for all these wonderful resources you've created, you've helped many many people.