Fork me on GitHub
#untangled
<
2016-07-20
>
therabidbanana16:07:14

I'm dealing with a bug report of UTF-8 characters not showing correctly. Has anybody seen any issues with utf-8 in untangled? Starting to look like it might be because the transit middleware in untangled isn't assigning a default charset of utf-8?

therabidbanana16:07:06

(The £ symbol is fine when pushed over our websocket subscription, but when I refresh the page and it's pulled via /api, suddenly it renders incorrectly)

mahinshaw17:07:07

@therabidbanana: The transit encoding is definitely different if you are using untangled-websockets. But at the end of the day, websockets uses a lot of the same code. The transit encoding happens in untangled.server.impl.middleware

therabidbanana17:07:21

We're using our own websocket implementation

therabidbanana17:07:42

But I think I've figured out how to reproduce - JVM on our production servers must have locale settings that make it think ASCII is the default if one is not provided.

therabidbanana17:07:34

If we boot the jvm with -Dfile.encoding=utf-8, it works as expected, so probably not a bug, but maybe a potentially dangerous undefined default somewhere in transit encoder setup?

mahinshaw17:07:09

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.

mahinshaw17:07:53

Last link is the transit write

mahinshaw17:07:46

line 11 ret (.toString baos) => ret (.toString baos “UTF-8”)

mahinshaw17:07:13

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

therabidbanana19:07:55

Do we think it's something untangled should enforce? Happy to submit a patch for it if that's the way we wanted to go, but wasn't sure if we want to make that assumption for everyone

mahinshaw19:07:55

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

tony.kay22:07:50

@jasonjckn: on your diff patch. how well tested is that from a cljs perspective? Have you written and run tests in the spec?

tony.kay22:07:02

@adambros: is out, not sure when he can get to a review

tony.kay22:07:37

I'd be ok pulling it into develop SNAPSHOT if you're highly confident in it and have actually run it through tests on the clj and cljs sides.