What's the best way to change the encoding of many text files at once?

What's the best way to change the encoding of many text files at once?
Here I want to convert all of these from ANSI to UTF-8, for instance.

Attached: Untitled.png (319x242, 11K)

Other urls found in this thread:

wiki.python.org/moin/BeginnersGuide
twitter.com/NSFWRedditGif

Write a program to do it, then write a script to use that program on multiple files. Toss in a GUI, and bam you may have learned something.

Oof. Surely, there is one #1 program everyone uses already I don't know about.

>Oof
>>>/reddit/

iconv

for f in *; do iconv -o "out_$f" -f ANSI_X3.110 -t UTF-8 "$f"; done

Where do I write this, visual studio doesn't compile
Any windows alternatives?

>Any windows alternatives?
No

>Any windows alternatives?

Attached: 1535157658718.png (224x309, 115K)

You think everyone runs linus?

Dont blame others because you use inferior technology

fuck you ill go write my own oconverter and it will be better thab linux im so pissed

Here dumbass. Try not to fuck it up.

import codecs
BLOCKSIZE = 1048576
with codecs.open(sourceFileName, "r", "your-source-encoding") as sourceFile:
with codecs.open(targetFileName, "w", "utf-8") as targetFile:
while True:
contents = sourceFile.read(BLOCKSIZE)
if not contents:
break
targetFile.write(contents)

nu-Jow Forums, everybody.
Fucking brainlets.

Attached: image0-1.jpg (750x700, 448K)

(for %%i in (*.srt) do "C:\Program Files (x86)\GnuWin32\bin\iconv.exe" -f CP1252 -t UTF-8 '%%i' >> 'utf8-%%i')

Something like that in windows.

Dude what language is this? Lua? Where do I put this?

Stop asking to be spoon fed, retard.

Thanks. Any GUIs?

batch script

Bad help is worse than no help

try renbatch

I can make a GUI app for windows real quick if you can pay my dinner.
t. third world shithole dweller

Spoonfeeding you is bad help because you'll learn absolutely nothing and you'll just come back for more.
wiki.python.org/moin/BeginnersGuide

ah sorry, i hadn't seen you wanted to change the contents of the file

I don't want to learn but to get shit done but thanks for your help

fuck off mr teacher
go back to the macfag corner

>Any GUIs?
faggot

Nice try pajeet

OK send me your bitcoin address

I'm not pajeet but whatever you want to believe, insecure whiteboy. I can pull this shit off in 4 different languages and it'll run on any OS. Looking at the posts itt i'm not surprised you neanderthals can't compete with literal poos.

I get paid to program innovative and intuitive GUIs for cool apps, not text encodings

Are you OP? email me [email protected], i'll do it and you pay can me whatever afterwards, anything beats shitposting at this point.

>cock.li
Oof.
Fuck this thread

Just spend the hour or so doing it yourself. Much more rewarding, and like the other user said, you might learn something.

gosh okay but if i suicide its on you

>he needs a GUI

Attached: 1523900920823.jpg (674x674, 74K)

>BLOCKSIZE = 1048576
What is this

yes, python.

Not him, but that's the size of a MB.

Oh I see but why am I reading a megabyte?

Again, I'm not him, but that's just the read size he chose. In other words, it's an arbitrary choice.

>Poirot

Truly a man of superior and refined taste.
Enjoy the Hercule and his classy fella Hastings!

It's actually 1 MiB (memebytes), but you can probably just enter any arbitrary value as long as it's larger than your largest text file.

...

Correction since I didn't read the code, it's arbitrary and you can enter any value regardless of filesize, most optimal would probably be factors of 512.

No, macfags can run it too.

Oh cool so it automatically stops upon EOF?

Isn't ANSI and UTF-8 binary compatible?

Attached: anime-girl-confused-png-3.png (700x700, 50K)

Maybe. But it's not human-compatible as in it displays wrong on my non-pirated movies.

Based user forgot his for loop. I changed it to work on all files in a directory.

import codecs
import os

for file in os.listdir("YOUR DIRECTORY HERE):

BLOCKSIZE = 1048576 # or some other, desired size in bytes
with codecs.open(sourceFileName, "r", "ansi") as sourceFile:
with codecs.open(targetFileName, "w", "utf-8") as targetFile:
while True:
contents = sourceFile.read(BLOCKSIZE)
if not contents:
break
targetFile.write(contents)

wow you are golden. can you finally tell me how to get the equivalent of UINT64_MAX or something?

>REEEEEEE
Use code brackets, damn-it.

I'd imagine so. Python probably got that covered.

If the files are exactly the same then it's just a matter of interpretation. The .srt files probably have their text encoding in the header.

inb4 anons find the trickiest way to rm -rf my shit

For subtitles, use subtitle-related programs.

They have batch converters.

Pic Related

Attached: Pic_Related.png (1098x704, 123K)

>>Any windows alternatives?
>No
... yes
... pwrshell

>gayshell
>ass-backwards shell
>overly-verbose shell

>microshit

Attached: 10890513_1400540290240348_1460235940_n.jpg (640x640, 27K)

I like your style.

Attached: 1407696806433.jpg (590x788, 62K)

notepad++ has a macro function and can change encoding.