Fork me on GitHub

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?


(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)


@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


We're using our own websocket implementation


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.


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?


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.


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


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


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


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


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


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.