TyroElite Posted July 30, 2009 Posted July 30, 2009 My question is I'm sure backwards to many but I have existing text files which are all UTF-8 encoded. For backwards compatibility with another application that reads these files, I need to convert them all to ANSI. What is the best way to do this? other than a macro to file->open, file->save as, change to ansi, save, close. There must be an easier way to convert the entire file. Thanks for any suggestions!
KaFu Posted July 30, 2009 Posted July 30, 2009 Try parsing source files with these functions... Func _UNICODE2ANSI($sString = "") ; Convert UTF8 to ANSI to insert into DB ; http://www.autoitscript.com/forum/index.php?showtopic=85496&view=findpost&p=614497 ; ProgAndy ; Make ANSI-string representation out of UTF-8 Local Const $SF_ANSI = 1 Local Const $SF_UTF8 = 4 Return BinaryToString(StringToBinary($sString, $SF_UTF8), $SF_ANSI) EndFunc ;==>_UNICODE2ANSI Func _ANSI2UNICODE($sString = "") ; Extract ANSI and convert to UTF8 to display ; http://www.autoitscript.com/forum/index.php?showtopic=85496&view=findpost&p=614497 ; ProgAndy ; convert ANSI-UTF8 representation to ANSI/Unicode Local Const $SF_ANSI = 1 Local Const $SF_UTF8 = 4 Return BinaryToString(StringToBinary($sString, $SF_ANSI), $SF_UTF8) EndFunc ;==>_ANSI2UNICODE OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
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