Graeme Posted April 3, 2023 Posted April 3, 2023 I have a script that uses GUIs and iniread to create labels in given languages, French, German and Korean for example. I have just realised that after the update to 3.3.16.0 the script no longer reads non English strings correctly. This GUI used to show as as Mettre à jour and Masquer la fênetre. Is there a way of correcting this with an option or something?
Graeme Posted April 3, 2023 Author Posted April 3, 2023 I tried running a program compiled before I updated to 3.3.16.0 and that read the inifile correctly with the accents. However I went back to 3.3.14.2 which is the version I was using and restarted my computer and it still shows as above.
Moderators Melba23 Posted April 3, 2023 Moderators Posted April 3, 2023 Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
ioa747 Posted April 3, 2023 Posted April 3, 2023 (edited) try when you put this lines in your SciTEUser.properties code.page=65001 output.code.page=65001 NewFileEncoding=UTF8 utf8.auto.check=4 and restart SciTE Edited April 3, 2023 by ioa747 I know that I know nothing
Nine Posted April 3, 2023 Posted April 3, 2023 As per help file in IniWrite : Quote If you want to use an ini file with Unicode encoding, first create an .ini file by using the FileOpen() function with the mode parameter set to a Unicode parameter. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Solution SOLVE-SMART Posted April 3, 2023 Solution Posted April 3, 2023 (edited) Hi @Graeme, I assume (I understood) you already have one or more ini files that don't show for example german "umlauts" correct in the GUI. In this case you can simple rewrite the ini file to "UTF-16 LE" which will display the correct umlauts in the GUI. Try these test data: [SectionOne] KeyOne = Default text KeyTwo = German umlaut ÄäÜüÖöß Create a ini file (ini-read-test.ini) and save this example content (as UTF-8 which should be the default encoding for SciTE or VSCode). Then run the following script: expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Au3Stripper=y #AutoIt3Wrapper_UseUpx=n #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln _Actions() Func _Actions() Local Const $sIniFile = @ScriptDir & '\ini-read-test.ini' ;~ _RewriteIniFileToUtf16LittleEndian($sIniFile) ; You just have to use that ini rewrite one time, that's it. Local Const $sValueOne = IniRead($sIniFile, 'SectionOne', 'KeyOne', '') Local Const $sValueTwo = IniRead($sIniFile, 'SectionOne', 'KeyTwo', '') Local Const $hGui = _CreateGui($sValueOne, $sValueTwo) _GuiEventListener() _DisposeAndExit($hGui) EndFunc Func _RewriteIniFileToUtf16LittleEndian($sFile) Local Const $iReadWithUtf8NoBom = 256 Local Const $iWriteWithUtf16LittleEndian = 32 + 2 Local $hFile = FileOpen($sFile, $iReadWithUtf8NoBom) Local Const $sFileContent = FileRead($hFile) FileClose($hFile) $hFile = FileOpen($sFile, $iWriteWithUtf16LittleEndian) FileWrite($hFile, $sFileContent) FileClose($hFile) EndFunc Func _CreateGui($sLabelTextOne, $sLabelTextTwo) Local Const $hGui = GUICreate('ini-read-test') GUICtrlCreateLabel($sLabelTextOne, 15, 15) GUICtrlCreateLabel($sLabelTextTwo, 15, 50) GUISetState(@SW_SHOW, $hGui) Return $hGui EndFunc Func _GuiEventListener() Local Const $iGuiCloseEventFlag = -3 While True Switch GUIGetMsg() Case $iGuiCloseEventFlag ExitLoop EndSwitch WEnd EndFunc Func _DisposeAndExit($hGui) GUIDelete($hGui) Exit EndFunc 💡 First run should display the incorrect version of the german umlauts. Please activate line 12 _RewriteIniFileToUtf16LittleEndian() and run again. Now your ini is rewritten an the GUI displays the correct characters. ✨ Conclusion: Open your ini file(s) and rewrite them as "UTF-16 LE" (_RewriteIniFileToUtf16LittleEndian($sIniFile)) one time and you can use your script/program like before (I hope 🤞😀). Best regards Sven Edited April 3, 2023 by SOLVE-SMART ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 AutoIt Cheat Sheet Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
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