file .txt

Hello everybody.
I wrote a program to extract a text file, process it, and then rewrite it in another text file.
the program has always worked well, but in this case it should write in the second file, a text in Korean.
The problem is that once I run the code, when I go to open the text file manually, it tells me it's impossible to do it.
could you give me some suggestions? I'm really inexperienced.

I use xcode 9.0 and for text files I use the 'texedit' application.

Thanks in advance
open dos
confirm the file exist
dir <filename.txt">
type <filename.txt">

If that works then your file is ok, if not then maybe it's binary or something and you can figure it out.
The problem is that a "textfile" containing Korean characters isn't a text file in the 20th century sense of the word, since the characters aren't based solely on 8-bit containers.

The Macintosh terminal handles them quite nicely, but if your program is processing it as strictly chars, it could be changing it into something else entirely.

Open terminal, and cd to the directory your program and its outputs are in. Use the "cat" command and the "less" command to view the files...

cat filename.txt | less

See what they were, what they are, etc. This will definitely open the file "manually". What's inside?
I will try to explain myself better.
the problem is that even if imposed in the 'texedit' application, a particular encoding of the text (Korean example), when I try to open the file.txt, 'texedit' gives me error like: 'unable to open with windows latin 1 '.
  This means that the compiler misinterprets the type of encoding within the file.txt (or at least I think).

looking on the net, I found that in a text file, the type of encoding inside the file is signaled at the beginning of the file itself, through a hexadecimal code.
I would like to try to intervene on that initial code.

it's possible?

thanks
Topic archived. No new replies allowed.