ahmetpi Posted December 12, 2020 Share Posted December 12, 2020 Hi, I have an ini file which contains special Turkish characters like ş, Ö, İ, ı.... Example ini: [İnkılap] key=value [Türkçe] key=value Example code: $var1="İnkılap" $var2 = IniReadSection(".....inifilepath\example.ini", $var1) MsgBox(0, "Example", $var2 =) It returns nothing. So, how can i fix this? I am kinda noob so if you can give me an example code, i would be very glad Link to comment Share on other sites More sharing options...
GokAy Posted December 12, 2020 Share Posted December 12, 2020 Selam, Your usage seems to be wrong? The return from inireadsection is an array The number of elements returned will be in $aArray[0][0]. If an @error occurs, no array is created. $aArray[0][0] = Number $aArray[1][0] = 1st Key $aArray[1][1] = 1st Value $aArray[2][0] = 2nd Key $aArray[2][1] = 2nd Value Try: msgbox(0,"Example", $var2[1][0] & " - " & $var2[1][1]) ahmetpi 1 Link to comment Share on other sites More sharing options...
ahmetpi Posted December 12, 2020 Author Share Posted December 12, 2020 3 minutes ago, GokAy said: Selam, Your usage seems to be wrong? The return from inireadsection is an array The number of elements returned will be in $aArray[0][0]. If an @error occurs, no array is created. $aArray[0][0] = Number $aArray[1][0] = 1st Key $aArray[1][1] = 1st Value $aArray[2][0] = 2nd Key $aArray[2][1] = 2nd Value Try: msgbox(0,"Example", $var2[1][0] & " - " & $var2[1][1]) Selam abi, çok teşekkürler cevapladığın için İngilizce bilgim çok iyi değil o yüzden Türkçe yazayım en iyisi Dediğiniz doğru IniReadSection'u yanlış kullanmışım ancak onu düzeltsem bile içinde Türkçe karakter olan section'ları getirmiyor nedense. Bu section name'leri bir input ile ini dosyasına kayıt ediyorum o input kısmında türkçe karakterleri elemem filan mümkün mü acaba? Belki o şekilde yapabilirim diye düşündüm ben Link to comment Share on other sites More sharing options...
TheXman Posted December 12, 2020 Share Posted December 12, 2020 (edited) If you save your ini file with UTF-16LE with BOM encoding, it handles Turkish characters. #include <Constants.au3> #include <Debug.au3> example() Func example() Local $aIniSection $aIniSection = IniReadSection("test.ini", "Türkçe") If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "IniReadSection failed - @error = " & @error) _DebugArrayDisplay($aIniSection, "Türkçe Section") MsgBox($MB_ICONINFORMATION + $MB_TOPMOST, "Türkçe", "Key = " & IniRead("test.ini", "Türkçe", "Key", "Not Found")) EndFunc Edited December 12, 2020 by TheXman GokAy and ahmetpi 1 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
GokAy Posted December 12, 2020 Share Posted December 12, 2020 (edited) @TheXman With this key-value pair the read key-value in SciTe is half correct [İnkılap] ççşş=asjsks Console Output: ççþþ - asjsks Edited December 12, 2020 by GokAy ahmetpi 1 Link to comment Share on other sites More sharing options...
TheXman Posted December 12, 2020 Share Posted December 12, 2020 (edited) The console will not display it correctly. Try MsgBox. Edited December 12, 2020 by TheXman ahmetpi 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
GokAy Posted December 12, 2020 Share Posted December 12, 2020 (edited) Yes, it does. Thanks. Also, figured out I have never used Turkish in my code Edited December 12, 2020 by GokAy TheXman and ahmetpi 1 1 Link to comment Share on other sites More sharing options...
ahmetpi Posted March 21, 2021 Author Share Posted March 21, 2021 (edited) On 12/12/2020 at 5:55 PM, TheXman said: If you save your ini file with UTF-16LE with BOM encoding, it handles Turkish characters. #include <Constants.au3> #include <Debug.au3> example() Func example() Local $aIniSection $aIniSection = IniReadSection("test.ini", "Türkçe") If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "IniReadSection failed - @error = " & @error) _DebugArrayDisplay($aIniSection, "Türkçe Section") MsgBox($MB_ICONINFORMATION + $MB_TOPMOST, "Türkçe", "Key = " & IniRead("test.ini", "Türkçe", "Key", "Not Found")) EndFunc Hi again, How can i save ini file with UTF16-LE ? I cant find on text editor EDİT : I solved with sublime text editor, thanks again Edited March 21, 2021 by ahmetpi Solved Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now