Skip to content

Multi-byte chars count as more than one char #1052

@pebo

Description

@pebo

Describe the bug
When using a maxLength constraint on a string multi-byte chars such as ö is counted as more than one length unit (two for ö).

To Reproduce
Edit the test testing maxLength: 10

  it('should return 200 if short b-name is fetched', async () =>
    request(allErrorsApp)
      .get(`${allErrorsApp.basePath}/persons?bname=Boböööö`)
      .expect(200));

Actual behavior
Test fails.

Expected behavior
The ö chars should count as one length unit so the string Boböööö should have length 7.

Examples and context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions