Can I create a new INI file with different encoding?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
sl23
Posts: 285
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Can I create a new INI file with different encoding?

Post by sl23 »

I have made a simple script for a button to display a menu:

Code: Select all

$menu = <<<MENU
            New Folder|;#231;|:newfolder
            New INI|; new("New INI File.ini", , , "r");|<xyicons>\Syn.png
            New RTF|; new("New RTF File.RTF", , , "r");|<xyicons>\Syn.png
            Save Text|; $a = input("Enter Text",,, "m",,640,500);  $b = input("Enter Name"); writefile("<curpath>\$b.ini", "$a");|<xyicons>\Syn.png
            New DOCX|; new("New DOCX File.docx", , , "r");|<xyicons>\Textmaker.png
            -
            Hidden Files|;#493;|<xyicons>\hidden0.png
            Back|;#527;|:back
            -
            Undo|;#203;|:undo
            Redo|;#204;|:redo
            -
            Preview Pane|;#674;|:pp
            -
            Copy Name|;#102;|:clipcopy
            Copy Path|;#103;|:copypath
            Search IMDB|;Open ("https://www.imdb.com/find?s=tt&q=<curbase>");|<xyicons>\IMDB.png
            Search Discogs|;Open ("https://www.discogs.com/search/?q=<curbase>");|<xyicons>\Discogs.png
            YouTube dl|; load "Youtube.xys";|<xyicons>\3dyd64-YT.png
            -
            - Dual Pane
              Dual Pane|;#800;|:dp
              Dual Pane 50/50|; load "DualPane-50.50.xys";|:dp
              Dual Pane %|; load "DualPane%.xys";|:dp
            - Move + Rename
              Move Up|;sel a; #1056;|:moveto
              Move Up + Del Folder|;$path = "<curpath>"; $parent = regexreplace($path, "(.*(?=\\))(.*)", "$1"); #1056; goto $parent; delete 1, 0, $path;|:moveto
              Rename to Folder|;rename , "<curfolder>";|:rename
              Sort into Folders - Month|; load "Sort into Folders - Month.xys";|:sort
              Sort into Folders - Year|; load "Sort into Folders - Year.xys";|:sort
            - View
              Details|;#302;|:views
              Details + Thumbs|;#303;|:views
              Large Tiles|;#314;|:views
              Show/Hide Junctions|;#495;|:views
            -
            Options|;#600;|:conf
            MENU;
       $sel = popupnested($menu, 7:="|");
       if ($sel) { load $sel, , "s"; }
Currently, the menu works well, but when I create a new INI file, it is always in UTF8, and I have to manually change every file to UTF-16 LE with BOM.
Is it possible to do this automatically on creation using a script? I couldn't find anything in the manual about this. I searched for "encoding" and "new file".
Thanks for any help. :tup:
Last edited by sl23 on 08 Feb 2026 16:35, edited 1 time in total.

highend
Posts: 14923
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Can I create a enw INI file with different encoding?

Post by highend »

writefile()...
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 285
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: Can I create a new INI file with different encoding?

Post by sl23 »

Thanks, that was just what I needed! :tup:

Post Reply