The limit says bytes. Is your form counting letters?
A form accepts a name and shows a length counter. Yet the connection to another tool rejects some names containing accents or symbols. One possible cause is that the two sides measure different things: the interface counts text length while the service imposes a byte limit. This is an illustrative example, not a diagnosis for every submission error.
First, establish what the service limits
Before shortening a field, read the receiver's documentation. The limit may apply to visible text, code units, the bytes of one field or the entire request body. The encoding matters too. A number without a unit cannot tell you what is allowed.
In UTF-8, the letter A takes one byte and the precomposed letter à takes two bytes. The € symbol takes three. These are calculated examples for those exact texts, without quotes, spaces or line breaks. They do not represent the size of a complete request.
JavaScript's counter may answer a different question
A JavaScript string's length property counts UTF-16 code units. It is not a UTF-8 byte counter or a general measure of what a person perceives as letters. Using that length to validate a transport limit can produce the wrong answer.
MDN documents TextEncoder.encode(): it takes text and returns a Uint8Array containing its UTF-8 encoding. To measure a field's bytes in that encoding, you can use new TextEncoder().encode(text).length. That measurement applies only to the text you passed in.
Measure what you actually send
If the limit applies to the whole JSON body, measure the final representation you will send, including keys, quotes and other fields. Do not count only the visible letters in the name. Keep the server-side check as well: the browser helps provide feedback, but it is not the only entry point.
If the text exceeds the limit, explain the unit and preserve what the person entered so they can adjust it. Do not blindly cut bytes: you may split an encoded sequence and damage the text.
Test beyond the simplest alphabet
Include names with accents, symbols and text pasted from other tools. Test just below and above the documented limit. The desired outcome is not accepting every input: it is making the counter, validation and error message use the same measure.