Skip to content

Default Encoding For Transit Middleware #9

@adstage-david

Description

@adstage-david

Traced back an encoding issue only happening in production in our Untangled app to a JVM configuration option - specifically, locally I was using equivalent of -Dfile.encoding=utf-8 JVM_OPTS flag (actually had an environment variable: export LC_ALL=en_US.utf8, but Java uses that if file.encoding not set, apparently)

Seems like the transit encoder, since it is not told which encoding to use, just uses system default, which might change based on where an app is deployed - so probably not good to leave this behavior undefined.

Context from @mahinshaw on Slack:

This looks useful.  We could change the writer to always write UTF-8.  My guess i there is an environment issue with the ByteArrayOutputStream on your system.  It could be configureable too.

https://github.com/untangled-web/untangled-server/blob/master/src/untangled/server/impl/middleware.clj#L7

Last link is the transit write

line 11 `ret (.toString baos)` => `ret (.toString baos "UTF-8")`

It might be worth testing that with checkouts in your environment and seeing it it resolves something

It should definitely be configurable, but in the end, fall back to utf-8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions