Comment limit of 1000 characters broken?
Trying to post a comment that's 864 characters long and Steam won't let me, I get an error message. No emojis or anything.
Escrito originalmente por metamec:
Latin characters occupy 1 byte.
Cyrillic characters occupy 2 bytes.

> new TextEncoder().encode('Й').length; // Cyrillic Й <. 2 > new TextEncoder().encode('ё').length; // Cyrillic ё <. 2 > new TextEncoder().encode('N').length; // Latin N <. 1 > new TextEncoder().encode('здрав').length; <. 10 > new TextEncoder().encode('hello').length; <. 5

You can verify the above in the console (ctrl+shift+i) of your internet browser.

TLDR: If your comment is entirely in Cyrillic then your new limit is 500 characters.

Edit: Actually, I just realised that it will be slightly higher than 500 because spaces occupy only 1 byte. It's always the same space character, regardless of script.
< >
Exibindo comentários 15 de 5
nullable 22/mar./2024 às 6:33 
It's hard to say without seeing the content. The count could be broken, but it's possible there's some details you're ignoring.

Also if you're using a lot of unicode characters there's times depending on how the clientside versus serverside validation works where you might get disagreeing validation results. But seeing the content would help clarify that.
Ettanin 22/mar./2024 às 6:49 
Note that characters that are not of the ASCII space such as ä ö ü ß are still subject to multi-byte mapping in UTF-8 and therefore count as multiple characters.
Sigma Female 22/mar./2024 às 7:17 
Escrito originalmente por Ettanin:
Note that characters that are not of the ASCII space such as ä ö ü ß are still subject to multi-byte mapping in UTF-8 and therefore count as multiple characters.
I wrote the entire thing in Cyrillic letters, maybe that's the case?
Ettanin 22/mar./2024 às 7:27 
Escrito originalmente por Mistress Yaoi:
Escrito originalmente por Ettanin:
Note that characters that are not of the ASCII space such as ä ö ü ß are still subject to multi-byte mapping in UTF-8 and therefore count as multiple characters.
I wrote the entire thing in Cyrillic letters, maybe that's the case?
yes, cyrillic characters are mapped using multiple bytes. The english Wikipedia has a good explanation on how this mapping with non-ASCII characters works.
O autor do tópico indicou esta mensagem como a resposta.
metamec 22/mar./2024 às 8:40 
Latin characters occupy 1 byte.
Cyrillic characters occupy 2 bytes.

> new TextEncoder().encode('Й').length; // Cyrillic Й <. 2 > new TextEncoder().encode('ё').length; // Cyrillic ё <. 2 > new TextEncoder().encode('N').length; // Latin N <. 1 > new TextEncoder().encode('здрав').length; <. 10 > new TextEncoder().encode('hello').length; <. 5

You can verify the above in the console (ctrl+shift+i) of your internet browser.

TLDR: If your comment is entirely in Cyrillic then your new limit is 500 characters.

Edit: Actually, I just realised that it will be slightly higher than 500 because spaces occupy only 1 byte. It's always the same space character, regardless of script.
Última edição por metamec; 22/mar./2024 às 8:50
< >
Exibindo comentários 15 de 5
Por página: 1530 50

Publicado em: 22/mar./2024 às 6:23
Mensagens: 5