KalleOlaviNiemitalo commented on code in PR #1798:
URL: https://github.com/apache/avro/pull/1798#discussion_r934288947


##########
lang/c/src/schema.c:
##########
@@ -48,20 +51,25 @@ static void avro_schema_init(avro_schema_t schema, 
avro_type_t type)
 
 static int is_avro_id(const char *name)
 {
-       size_t i, len;
+    setlocale(LC_ALL, "en_US.UTF-8");

Review Comment:
   Please don't call `setlocale` from the Avro C library. It affects all 
threads and its effects persist after `is_avro_id` returns. Instead, use 
functions that create and query a locale object without affecting global state:
   - [`newlocale`](https://man7.org/linux/man-pages/man3/newlocale.3p.html), 
[`iswalpha_l`](https://man7.org/linux/man-pages/man3/iswalpha.3p.html), and 
[`freelocale`](https://man7.org/linux/man-pages/man3/freelocale.3p.html) on 
POSIX
   - 
[`_create_locale`](https://docs.microsoft.com/cpp/c-runtime-library/reference/create-locale-wcreate-locale?view=msvc-170),
 
[`_iswalpha_l`](https://docs.microsoft.com/cpp/c-runtime-library/reference/isalpha-iswalpha-isalpha-l-iswalpha-l?view=msvc-170),
 and 
[`_free_locale`](https://docs.microsoft.com/cpp/c-runtime-library/reference/free-locale?view=msvc-170)
 on Windows



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to