Skip to content

Response ContentLength is invalid with 2-byte UTF-8 symbols in template #1

@grolfcry

Description

@grolfcry

For example - Cyrillic word "Привет".

Bug in DustCompilingFilter class in line

response.setContentLength(template.length());

You have to use

response.setContentLength(template.getBytes().length());

You use ByteOutputStream in response writer and when you write 2-bytes symbols to out (like "Привет") - length will be greater then template.length() (6) and will be equals to template.getBytes().length().

And when browser read the response stream, some last bytes will be lost and you get a error.

Please fix it

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