Repository: bazelbuild/bazel
Issue: ERROR: While parsing option --apple_platform_type=ios: Not a valid Apple platform type: 'ios' (should be ıos, watchos, tvos, macos or catalyst)
Labels: type: bug
platform: apple
untriaged
team-Rules-ObjC

### Description of the bug:


I am following tensorflow installation locally from [here](https://www.tensorflow.org/lite/guide/build_ios). I run configure then run this code:
`bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 \
  //tensorflow/lite/ios:TensorFlowLiteC_framework`

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.


following the link provided after cloning tensorflow from github.

### Which operating system are you running Bazel on?


macos monterey (intel)

### What is the output of `bazel info release`?


5.3.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.


-

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?


```text
-
```


### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Issue comments:
Hi @FahriBilici, Above issue related to [Tensorflow](https://github.com/tensorflow/tensorflow) lite.  Can you please check the above issue with the specific repo of [tensorflow](https://github.com/tensorflow/tensorflow). Please reach us back if the above issue is still relevant to Bazel, with complete details. Thanks!
@sgowroji This is indeed a bug in Bazel itself. Note how the error message says that `ios` is not a valid Apple platform type but then goes on to list it as valid - but with a Turkish lowercase i. 

I believe that this can be fixed by using `Ascii.toLowerCase` and `Ascii.equalsIgnoreCase` in the methods of https://cs.opensource.google/bazel/bazel/+/669c298f71b5f8fbef8f62c85543cda3eab4dfcc:src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java;drc=669c298f71b5f8fbef8f62c85543cda3eab4dfcc;l=246. Can't fix it myself right now, could you assign it (probably to the Apple team)?
Yes I truly believe the issue displayed because of case sensitivity.
I submitted a fix: https://github.com/bazelbuild/bazel/pull/17687

Bazel didn't really work at all with a Turkish locale (e.g. it fails when it encounters a `size = "medium"` on a test). The workaround is to specify a different locale with:
```
bazel --host_jvm_args=-Duser.country=US --host_jvm_args=-Duser.language=en build ...
```

Pull request review comments:

Patch that resolved the issue:
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index ee0b32268bf47d..459dd524c62dc8 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -402,6 +402,13 @@ static vector<string> GetServerExeArgs(const blaze_util::Path &jvm_path,
 
   // Force use of latin1 for file names.
   result.push_back("-Dfile.encoding=ISO-8859-1");
+  // Force into the root locale to ensure consistent behavior of string
+  // operations across machines (e.g. in the tr_TR locale, capital ASCII 'I'
+  // turns into a special Unicode 'i' when converted to lower case).
+  // https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Locale.html#ROOT
+  result.push_back("-Duser.country=");
+  result.push_back("-Duser.language=");
+  result.push_back("-Duser.variant=");
 
   if (startup_options.host_jvm_debug) {
     BAZEL_LOG(USER)


Test patch: