1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System.Reflection;
6 using System.Runtime.InteropServices;
10 [DllImport("libc", EntryPoint = "setlocale")]
11 public static extern IntPtr setlocale(int category, [MarshalAs(UnmanagedType.LPStr)] string locale);
13 public static int Main()
15 Assembly a1 = Assembly.GetExecutingAssembly();
17 // In case of Turkish locale:
18 // towupper 'i' -> \x0130 (instead of 'I')
19 // towlower 'I' -> \x0131 (instead of 'i')
20 const string TRLocale = "tr_TR.UTF-8";
21 IntPtr res = setlocale(6 /*LC_ALL*/, TRLocale);
22 if (TRLocale != Marshal.PtrToStringAnsi(res))
24 Console.WriteLine("Failed! " + TRLocale + " locale was not found in system!");
28 Assembly a2 = Assembly.Load("Ii");
32 Console.WriteLine("Failed!");
36 Console.WriteLine("Passed!");