Geeklog: What I Learnt Today / Adam

Generating .res files ICU version matters

> I came across an odd issue generating res files, I could generate the res files fine but found when I uploaded them it just killed the site. Turns out versions matter when generating them. This was a php site. I found that when I did it on a mac with a newer version of ICU (52.1) it didn't work with the server online having an older version of ICU (4.2.1) I added an old version of ICU that matched on a windows box which solved the issue. You can see the current ICU version installed on a page displaying phpInfo();
To generate the res file on a mac
genrb –encoding utf-8 root.txt

To generate on windows
c:\program files\icu\bin\genrb.exe –encoding utf-8 root.txt

To check it in isolation in php

/* create resource bundle */
foreach (array("root") as $locale) {
     $r = ResourceBundle::create($locale, __DIR__);
     /* use a changed key to check it works */
     echo $r["key-you-know-exists-in-root-txt"], "\n";

/ Adam