From 1afe1282f3232589f8c6589106815913b608460e Mon Sep 17 00:00:00 2001
From: George Rhoten
Some deprecated C APIs can be enabled without recompiling the ICU - libraries. This can be achieved by defining certain symbols before - including the ICU header files. For example, to enable deprecated C APIs - for formatting.
--#ifndef U_USE_DEPRECATED_FORMAT_API -# define U_USE_DEPRECATED_FORMAT_API 1 -#endif - -#include "unicode/udat.h" - -int main(){ - UDateFormat *def, *fr, *fr_pat ; - UErrorCode status = U_ZERO_ERROR; - UChar temp[30]; - - fr = udat_open(UDAT_FULL, UDAT_DEFAULT, "fr_FR", NULL,0, &status); - if(U_FAILURE(status)){ - printf("Error creating the french dateformat using full time style\n %s\n", - myErrorName(status) ); - } - /* This is supposed to open default date format, - but later on it treats it like it is "en_US". - This is very bad when you try to run the tests - on a machine where the default locale is NOT "en_US" - */ - def = udat_open(UDAT_SHORT, UDAT_SHORT, "en_US", NULL, 0, &status); - if(U_FAILURE(status)){ - .... /* handle the error */ - } -} -- -
Deprecated C++ APIs cannot be enabled without recompiling ICU libraries. - Every service has a specific symbol that should be defined to enable the - deprecated API of that service. For example: To enable deprecated APIs in - transliteration service, the U_USE_DEPRECATED_TRANSLITERATOR_API symbol - should be defined before compiling ICU.
-