Address #639.
This commit is contained in:
parent
9c4b040771
commit
cc023c26b7
|
@ -2003,7 +2003,6 @@ int main( int argc, char** argv )
|
||||||
ctmbstr cfgfil = NULL, errfil = NULL, htmlfil = NULL;
|
ctmbstr cfgfil = NULL, errfil = NULL, htmlfil = NULL;
|
||||||
TidyDoc tdoc = NULL;
|
TidyDoc tdoc = NULL;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
tmbstr locale = NULL;
|
|
||||||
|
|
||||||
uint contentErrors = 0;
|
uint contentErrors = 0;
|
||||||
uint contentWarnings = 0;
|
uint contentWarnings = 0;
|
||||||
|
@ -2023,13 +2022,10 @@ int main( int argc, char** argv )
|
||||||
/* Set an atexit handler. */
|
/* Set an atexit handler. */
|
||||||
atexit( tidy_cleanup );
|
atexit( tidy_cleanup );
|
||||||
|
|
||||||
/*************************************/
|
/* Set the locale for tidy's output. This both configures LibTidy to
|
||||||
/* Set the locale for tidy's output. */
|
use the environment's locale as well as the standard library.
|
||||||
/*************************************/
|
*/
|
||||||
locale = tidySystemLocale(locale);
|
tidySetLanguage( setlocale( LC_ALL, "") );
|
||||||
tidySetLanguage(locale);
|
|
||||||
if ( locale )
|
|
||||||
free( locale );
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
/* Force Windows console to use UTF, otherwise many characters will
|
/* Force Windows console to use UTF, otherwise many characters will
|
||||||
|
|
|
@ -1969,12 +1969,6 @@ TIDY_EXPORT uint TIDY_CALL getNextErrorCode( TidyIterator* iter );
|
||||||
** @{
|
** @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Determines the current locale without affecting the C locale.
|
|
||||||
** @param result The buffer to use to return the string, or NULL on failure.
|
|
||||||
** @return The same buffer for convenience.
|
|
||||||
*/
|
|
||||||
TIDY_EXPORT tmbstr TIDY_CALL tidySystemLocale(tmbstr result);
|
|
||||||
|
|
||||||
/** Tells Tidy to use a different language for output.
|
/** Tells Tidy to use a different language for output.
|
||||||
** @param languageCode A Windows or POSIX language code, and must match
|
** @param languageCode A Windows or POSIX language code, and must match
|
||||||
** a TIDY_LANGUAGE for an installed language.
|
** a TIDY_LANGUAGE for an installed language.
|
||||||
|
|
|
@ -295,38 +295,6 @@ ctmbstr TY_(tidyLocalizedString)( uint messageType )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
** Determines the current locale without affecting the C locale.
|
|
||||||
** Tidy has always used the default C locale, and at this point
|
|
||||||
** in its development we're not going to tamper with that.
|
|
||||||
** @note this routine uses default allocator, see tidySetMallocCall.
|
|
||||||
** @param result The buffer to use to return the string.
|
|
||||||
** Returns NULL on failure.
|
|
||||||
** @return The same buffer for convenience.
|
|
||||||
*/
|
|
||||||
tmbstr TY_(tidySystemLocale)(tmbstr result)
|
|
||||||
{
|
|
||||||
ctmbstr temp;
|
|
||||||
TidyAllocator* allocator = &TY_(g_default_allocator);
|
|
||||||
|
|
||||||
/* This should set the OS locale. */
|
|
||||||
setlocale( LC_ALL, "" );
|
|
||||||
|
|
||||||
/* This should read the current locale. */
|
|
||||||
temp = setlocale( LC_ALL, NULL);
|
|
||||||
|
|
||||||
/* Make a new copy of the string, because temp
|
|
||||||
always points to the current locale. */
|
|
||||||
if (( result = TidyAlloc( allocator, strlen( temp ) + 1 ) ))
|
|
||||||
strcpy(result, temp);
|
|
||||||
|
|
||||||
/* This should restore the C locale. */
|
|
||||||
setlocale( LC_ALL, "C" );
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the POSIX name for a string. Result is a static char so please
|
* Retrieves the POSIX name for a string. Result is a static char so please
|
||||||
* don't try to free it. If the name looks like a cc_ll identifier, we will
|
* don't try to free it. If the name looks like a cc_ll identifier, we will
|
||||||
|
|
|
@ -2472,11 +2472,6 @@ uint TIDY_CALL getNextErrorCode( TidyIterator* iter )
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
tmbstr TIDY_CALL tidySystemLocale(tmbstr result)
|
|
||||||
{
|
|
||||||
return TY_(tidySystemLocale)( result );
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool TIDY_CALL tidySetLanguage( ctmbstr languageCode )
|
Bool TIDY_CALL tidySetLanguage( ctmbstr languageCode )
|
||||||
{
|
{
|
||||||
return TY_(tidySetLanguage)( languageCode );
|
return TY_(tidySetLanguage)( languageCode );
|
||||||
|
|
Loading…
Reference in a new issue