AnsweredAssumed Answered

Locale support

Question asked by ranva on Jul 15, 2013
Latest reply on Jul 19, 2013 by sonic

Hello!

 

I need a support of wchar_t on my device (based on bf-537, ADI-2012R2-RC2 toolchain and buildroot 2012.08) As I googled, firstly I installed the full version of tollchain, then I pointed that toolchain has support of wchar and locale, I also turned on the unicode support in busybox, and entered the last char code as 4351. After that I built and installed system onto device without any errors.

But the call of "setlocale(LC_ALL, "ru_RU.UTF-8")" in my programm always returns NULL. It seems to me that I should place some locale data somewhere to rootfs, but I don't have any idea where to get that data and where to place it.

Is it possible to add support of locale in order to use wprintf family of functions?

 

Here is the simple hello-world test I used. It works well on my host, but always returns error on blackfin. If I remove checking of returned value of setlocale, then wprintf with russian letters always prints "Invalid wide format string."

 

#include <stdio.h>

#include <stdlib.h>

#include <wchar.h>

#include <locale.h>

 

int main(int argc, char *argv[])

{

    if(setlocale(LC_ALL, "ru_RU.UTF-8") == NULL) {

        wprintf(L"Error setting locale\n");

        return EXIT_FAILURE;

    }

    wprintf(L"Привет!\n");

    return EXIT_SUCCESS;

}

 

Best regards,

Fedor Skripnikov

Outcomes