<div dir="ltr">They only need to use "str".toLowerCase(Locale.ROOT).<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 27, 2023 at 1:18 PM Xuelei Fan <<a href="mailto:xuelei.f@gmail.com" target="_blank">xuelei.f@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Just curious, this is a known issue for many years, how those areas like Turkish survive? Is there a workaround for those areas or the use of the methods is not common any longer?<div><br></div><div>Xuelei </div><div><br><blockquote type="cite"><div>On Jan 26, 2023, at 4:35 AM, Glavo <<a href="mailto:zjx001202@gmail.com" target="_blank">zjx001202@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div>At present, the no-parameter toLowerCase and toUpperCase methods of String are based on the default locale.<br><div><br></div><div>I checked all the uses of this method in OpenJDK, and found that most of the use cases are suspicious, and even there are some hidden bugs.<br></div><div>For example, I just found that jdk.incubator.vector.LaneType will trigger assertion failure on Turkish locale, and opened a PR for this problem:<br></div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><a href="https://github.com/openjdk/panama-vector/pull/210" target="_blank">https://github.com/openjdk/panama-vector/pull/210</a></div><div><br></div></blockquote>In addition to such obvious problems, some use cases behave suspiciously after calling Locale.setDefault.<br><div>I am investigating these problems and preparing to open a PR to solve these hidden bugs.<br></div><div><br></div><div>In all the third-party libraries I have used, I have never seen the correct use of these two methods.<br></div><div>Although the behavior of modifying API methods is destructive, I think it is worthwhile to consider whether to modify its behavior for such a suspicious method.<br></div><div>If users need locale-sensitive case conversion, it may be better to explicitly use Locale.getDefault().<br></div><div>Using Locale.ROOT as the default value also helps to keep the behavior of these two methods consistent with equalsIgnoreCase, Character.toLowerCase/toUpperCase and other methods.<br></div><div><br></div><div>This is my rough idea. I hope to get your suggestions.</div></div></div>
</div></blockquote></div><br></div></blockquote></div>