Thursday, November 4, 2010

How to convert UTF-8 to uppercase in C++ or C

#include <iostream>
#include <glib.h>
#include <string.h>

int main() {
   char * a="Télécommande";
   a = (char *) g_utf8_strup((const gchar*) a, strlen(a));

   std::cout << a << std::endl;
}

compile with :
g++ `pkg-config --cflags --libs gib-2.0` s.cpp

Output of the above program:
TÉLÉCOMMANDE

If the library is not present install libglib2.0-dev

http://www.gnu.org/software/guile-gnome/docs/glib/html/Unicode-Manipulation.html

Friday, October 15, 2010

I18n::MissingInterpolationArgument in

missing interpolation argument in "%a, %{count} %b %Y %H:%M:%S %z" ({:object=>Mon, 13 Sep 2010 21:09:21 UTC +00:00} given)

This happend with rails 2.3.5 and the gem i18n 0.4.1

gem uninstall -v 0.4.1 i18n

solved the problem.

Also see this link for more info: http://groups.google.com/group/activescaffold/browse_thread/thread/ad73fbf2fc675dd6/efb52a91ba81cb4d