{"id":1454,"date":"2011-11-23T07:48:11","date_gmt":"2011-11-23T07:48:11","guid":{"rendered":"http:\/\/thekua.com\/atwork\/?p=1454"},"modified":"2011-11-23T07:48:26","modified_gmt":"2011-11-23T07:48:26","slug":"international-character-encodings-and-winstone","status":"publish","type":"post","link":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/","title":{"rendered":"International character encodings and Winstone"},"content":{"rendered":"<p>I&#8217;m writing a little web application to help me learn some German (yeah, a bit of <a href=\"http:\/\/en.wiktionary.org\/wiki\/yak_shaving\" title=\"Yak Shaving\">yak-shaving<\/a>) and I wanted to deploy it locally using an executable jar. I wrote about how to do this <a href=\"http:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/\" title=\"Executable war in maven\">previously using winstone<\/a> and that worked pretty well. Unlike dealing with a normal English character set, dealing with letters like \u00c3\u0178, \u00c3\u201e, \u00c3\u0153 and \u00c3\u2013 are pretty important. <\/p>\n<p>It looks like, by default, serving static HTML from winstone doesn&#8217;t seem to work unless you explicitly specify the character encoding as UTF-8. A simple web-filter applied to all URLs helps us here. Here&#8217;s an example in scala:<\/p>\n<pre class=\"brush: scala; title: ; notranslate\" title=\"\">import javax.servlet._\r\n\r\nclass ForceUtf8EncodingFilter extends Filter {\r\n  def doFilter(request:ServletRequest, response : ServletResponse, chain: FilterChain) {\r\n    response.setCharacterEncoding(&quot;UTF-8&quot;)\r\n    chain.doFilter(request, response)\r\n  }\r\n\r\n  def init(config: FilterConfig) { }\r\n\r\n  def destroy() { }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m writing a little web application to help me learn some German (yeah, a bit of yak-shaving) and I wanted to deploy it locally using an executable jar. I wrote about how to do this previously using winstone and that worked pretty well. Unlike dealing with a normal English character set, dealing with letters like [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,55],"tags":[],"class_list":["post-1454","post","type-post","status-publish","format-standard","hentry","category-development","category-scala","post-preview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>International character encodings and Winstone - patkua@work<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"International character encodings and Winstone - patkua@work\" \/>\n<meta property=\"og:description\" content=\"I&#8217;m writing a little web application to help me learn some German (yeah, a bit of yak-shaving) and I wanted to deploy it locally using an executable jar. I wrote about how to do this previously using winstone and that worked pretty well. Unlike dealing with a normal English character set, dealing with letters like [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/\" \/>\n<meta property=\"og:site_name\" content=\"patkua@work\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-23T07:48:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-11-23T07:48:26+00:00\" \/>\n<meta name=\"author\" content=\"Patrick\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@patkua\" \/>\n<meta name=\"twitter:site\" content=\"@patkua\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrick\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/\"},\"author\":{\"name\":\"Patrick\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"headline\":\"International character encodings and Winstone\",\"datePublished\":\"2011-11-23T07:48:11+00:00\",\"dateModified\":\"2011-11-23T07:48:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/\"},\"wordCount\":140,\"commentCount\":1,\"articleSection\":[\"Development\",\"Scala\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/\",\"name\":\"International character encodings and Winstone - patkua@work\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\"},\"datePublished\":\"2011-11-23T07:48:11+00:00\",\"dateModified\":\"2011-11-23T07:48:26+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2011\\\/11\\\/international-character-encodings-and-winstone\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"International character encodings and Winstone\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\",\"name\":\"patkua@work\",\"description\":\"The intersection of technology and leadership\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\",\"name\":\"Patrick\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"caption\":\"Patrick\"},\"sameAs\":[\"http:\\\/\\\/thekua.com\\\/atwork\"],\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/author\\\/patrick\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"International character encodings and Winstone - patkua@work","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/","og_locale":"en_US","og_type":"article","og_title":"International character encodings and Winstone - patkua@work","og_description":"I&#8217;m writing a little web application to help me learn some German (yeah, a bit of yak-shaving) and I wanted to deploy it locally using an executable jar. I wrote about how to do this previously using winstone and that worked pretty well. Unlike dealing with a normal English character set, dealing with letters like [&hellip;]","og_url":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/","og_site_name":"patkua@work","article_published_time":"2011-11-23T07:48:11+00:00","article_modified_time":"2011-11-23T07:48:26+00:00","author":"Patrick","twitter_card":"summary_large_image","twitter_creator":"@patkua","twitter_site":"@patkua","twitter_misc":{"Written by":"Patrick","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/#article","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/"},"author":{"name":"Patrick","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"headline":"International character encodings and Winstone","datePublished":"2011-11-23T07:48:11+00:00","dateModified":"2011-11-23T07:48:26+00:00","mainEntityOfPage":{"@id":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/"},"wordCount":140,"commentCount":1,"articleSection":["Development","Scala"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/","url":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/","name":"International character encodings and Winstone - patkua@work","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/#website"},"datePublished":"2011-11-23T07:48:11+00:00","dateModified":"2011-11-23T07:48:26+00:00","author":{"@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"breadcrumb":{"@id":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thekua.com\/atwork\/2011\/11\/international-character-encodings-and-winstone\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thekua.com\/atwork\/"},{"@type":"ListItem","position":2,"name":"International character encodings and Winstone"}]},{"@type":"WebSite","@id":"https:\/\/thekua.com\/atwork\/#website","url":"https:\/\/thekua.com\/atwork\/","name":"patkua@work","description":"The intersection of technology and leadership","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thekua.com\/atwork\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae","name":"Patrick","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","caption":"Patrick"},"sameAs":["http:\/\/thekua.com\/atwork"],"url":"https:\/\/thekua.com\/atwork\/author\/patrick\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/comments?post=1454"}],"version-history":[{"count":3,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1454\/revisions"}],"predecessor-version":[{"id":1457,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1454\/revisions\/1457"}],"wp:attachment":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/media?parent=1454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/categories?post=1454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/tags?post=1454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}