DataStore wont accept "<" or bytes 128-255

local text = "¿" -- aka "\191"
game:GetService("DataStoreService"):GetDataStore("Test"):SetAsync("test", text)

blob.png

Lua supports strings with bytes 0-255 :stuck_out_tongue: It would be nice having more than 1-127 for lots of things like blocky-voxel-map data, compact serializers, or just foreign text.

Also I don’t think this is documented on the wiki.

3 Likes

Last I played with it (years ago), there were combinations which would just silently fail because they’re considered unsafe for HTML. Using the string <string will result in a failure (the request was just dropped when I ran into this problem, but it might throw an error now).

These unsafe strings really should be documented on the wiki. Whoever has wiki editing rights, get to work!

When I needed binary data, my solution was to convert it into base64 using the range 32-95 with unsafe characters swapped with the characters above 95. It is a little hacky, but whatever.

1 Like

OH MY GOD YOU’RE RIGHT!!! DATASTORE IS BROKEN!!! O_O There could be cases in lots of games that randomly error.

local text = "asdf<asdf"
game:GetService("DataStoreService"):GetDataStore("Test"):SetAsync("test", text)

What if someone’s game had a feature where people could write books?

Possible solution on the c++ side: Parse data store requests and do fancy bit-byte math to squeeze 0-255 into 1-127.

I know the 0 byte is used for the end of a string, but for data stores, it would make much more sense to have an int at the beginning that states where the end is.

Knowing that we’re restricted to these characters js good.

All we really have to do is just replace the other bytes with valid characters before saving and decoding it when loading

‘"¿" – gsub to “\191”’

There are just so many unknown arbitrary limitations, and fixing it manually by replacing stuff on the lua side will just make data wider, and code slower. I think the whole issue with not being able to use “<” is very serious. There could be a dozen more cases that involve not being able to use quotes or slashes, who knows o_O
Knowing these problems I’d only be comfortable using alphanumeric characters.