Jump to content
Sign in to follow this  
yton

ANSI 2 UTF-8 and back

Recommended Posts

Greetings,

i have the script that should

1) open csv file with some data in notepad (initial file encoding is ANSI)

2) save file with the same data in UTF-8 encoding

$csv = (@ScriptDir & "\" & "in.csv")
$hWriteHandle = FileOpen($csv, 128+2)
FileSaveDialog(blablabla, $hWriteHandle)

now it saves in UTF-8

but it saves an empty file

well, in general i just need to switch from ANSI encoding to UTF-8

please, help

Edited by yton

Share this post


Link to post
Share on other sites

Try this...

$csv = (@ScriptDir & "\" & "in.csv")

$file_save = FileSaveDialog( "Choose a name.", @ScriptDir, "CSV files (*.csv)", 2)

If @error Then
    MsgBox(4096,"","Save cancelled.")
Else    
    $file = FileOpen($file_save, 128+2)
    If $file = -1 Then
       MsgBox(0, "Error", "Unable to open file.")
       Exit
    EndIf
    FileWrite($file, FileRead($csv))
    FileClose($file)

EndIf

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...