fix: The @IsByteLength() decorator does not validate correctly for multi-byte characters such as Japanese and Chinese. #2530
Labels
status: needs triage
Issues which needs to be reproduced to be verified report.
type: fix
Issues describing a broken feature.
Description
I am developing a service that targets Japanese.
I used the
IsByteLength()
decorator to limit the message length of the request body to 2048 bytes.However, it is not being validated as expected.
Minimal code-snippet showcasing the problem
I created a reproducible repository.
https://github.com/Suyama-Daichi/class-validator-2byte
The following code is an excerpt.
Expected behavior
If you send the following request:
The validation should pass and you should get the following response:
Actual behavior
If you send the following request:
A validation error will occur.
テスト
should be 6 bytes, so it should pass validation.Related issue
#775
The text was updated successfully, but these errors were encountered: