Open and save text file in proper encoding

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Open and save text file in proper encoding

Re: Open and save text file in proper encoding

by BriHecato » 02 Apr 2018, 09:41

It was so frrrackin simple - my code works as it should.

Re: Open and save text file in proper encoding

by jeeswg » 22 Feb 2018, 07:21

An example of getting the encoding by jNizM.
Check if middle-length hyphen exist in a word. - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 82#p133482

Re: Open and save text file in proper encoding

by nnnik » 22 Feb 2018, 07:09

If you do not know the original encoding of the file then noone does - it's not stored anywhere.
You could check for the UTF-8 BOM and check if there are any characters that break the UTF-8 rule though.
You could also write an analasys that analyses the raw data and decides on a specific encoding.

Re: Open and save text file in proper encoding

by BoBo » 22 Feb 2018, 05:35

Open and save text file in proper encoding

by BriHecato » 22 Feb 2018, 05:20

I'm working on little editor that change few values in txt file.

Opening with FileRead, jobfile, %path%
changing with StringReplace, jobfileready, jobfile, %changethis%, %changetothat%
Saving with FileDelete, %path% and FileAppend, %jobfileready%, %path%

But i've noticed that when in source jobfile are local characters then saved file is messed up and later it doesn't work where it should. Otherwise everythig works smoothly.

How to open and save keeping the original encoding (i'm not sure if it is ANSi or UTF-8) ??

Top