Jump to content
ahmetpi

Can't read section names which contains Turkish characters

Recommended Posts

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

Share this post


Link to post
Share on other sites

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])

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

image.png.8caf3bea07f971da599e2b797c26f8d0.png

image.png.bfb1e8645deb6244d71935c158c95adb.png

Edited by TheXman

Share this post


Link to post
Share on other sites

@TheXman 

With this key-value pair the read key-value in SciTe is half correct

[İnkılap]
ççşş=asjsks

Console Output:

ççþþ - asjsks

Edited by GokAy

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...