{"id":860,"date":"2014-04-03T15:10:17","date_gmt":"2014-04-03T19:10:17","guid":{"rendered":"http:\/\/www.joshho.com\/blog\/?p=860"},"modified":"2014-04-03T15:37:32","modified_gmt":"2014-04-03T19:37:32","slug":"working-with-genrb-and-icu4j","status":"publish","type":"post","link":"https:\/\/www.joshho.com\/blog\/2014\/04\/03\/working-with-genrb-and-icu4j\/","title":{"rendered":"Working with genrb and ICU4J"},"content":{"rendered":"<p>Wanting to use the messages in ICU4J, I was lead to believe one needed to run the command:<\/p>\n<p><code>genrb root.txt<\/code><\/p>\n<p>This produces root.res.<br \/>\nHowever using the following snippet results in the error message below:<\/p>\n<p><code>UResourceBundle urb = UResourceBundle.getBundleInstance(\"Your package path\",\"root\");<\/code><\/p>\n<p><span style=\"color: #ff0000; line-height: 1.5em;\"><code>&gt;Data file yourPackagePath\/root.res is corrupt - ICU data file error: Header authentication failed, please check if you have a valid ICU data file<\/code><\/span><\/p>\n<p><!--more--><br \/>\nthen after some googling came across one entry in the <a href=\"http:\/\/marc.info\/?l=icu4j-support&amp;m=109425775517203&amp;q=raw\">mailing list<\/a> that suggested I check the endian-ness.<\/p>\n<blockquote>\n<pre>Chris,\r\nAre you running generating the res file on a windows machine?\r\nIf yes you should run it through icuswap utility and make the res file \r\nbig endian before you can load it in ICU4J.\r\nHave a look at icu\/source\/tools\/genrb\/gendtjar.pl for more information.\r\n\r\nBest Regards,\r\n\r\nRam Viswanadha\r\n\r\nChris Hsu wrote:\r\n\r\n&gt; Hi;\r\n&gt; \r\n&gt; I am new to ICU4J. My understanding is that there is no Java tools to \r\n&gt; generate ICU resource bundle file from .txt to .res. Then I use \r\n&gt; genrb.exe from ICU4C. It generates .res file successfully. However, when \r\n&gt; my java program tries to use the resource bundle it encountered the \r\n&gt; following error.<\/pre>\n<\/blockquote>\n<p>It&#8217;s probably important to note that the icuswap utility looks to be discontinued.<\/p>\n<p>Anyways to fix this issue you need to do <code>icupkg -tb root.res<\/code> if using ICU4J when root.res was generated on windows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wanting to use the messages in ICU4J, I was lead to believe one needed to run the command:<\/p>\n<p><code>genrb root.txt<\/code><\/p>\n<p>This produces root.res.<br \/>\nHowever using the following snippet results in the error message below:<\/p>\n<p><code>UResourceBundle urb = UResourceBundle.getBundleInstance(\"Your package path\",\"root\");<\/code><\/p>\n<p><span style=\"color: #ff0000; line-height: 1.5em;\"><code>&gt;Data file yourPackagePath\/root.res is corrupt - ICU data file error: Header authentication failed, please check if you have a valid ICU data file<\/code><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-860","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/comments?post=860"}],"version-history":[{"count":11,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":871,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/860\/revisions\/871"}],"wp:attachment":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/media?parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/categories?post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/tags?post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}