Hi everybody!!

I would like to save a text file in Shift-Jis format but by default the file is always save in UTF-8.

I'm using fopen, fput and fclose to create and work with that file, but I don't think that there is any parameter for those functions which can modified the format of the saved data.

Another option would be after having the file saved in UTF-8 format, make a conversion to JIS, but no idea how to do that.

Btw, my OS is Debian Linux, for programming I'm using C on Anjuta.

Any help is welcome.

P.S.: Sorry for my poor English :S

Recommended Answers

All 5 Replies

Sorry Ancient Dragon, but it is not a problem with the OS; in Linux Shift-jis is compatible and works.
I just want to convert my file format. I have already some code that seems to works but using C++ or C#, here I am leaving the links:

C#:
http://www.example-code.com/csharp/utf8-to-shift-JIS.asp

C++:
http://www.example-code.com/vcpp/utf-8-shift-jis.asp

But I need to do something like this in C and I don't know which methods are available ( if they are).

Looks like you will have to translate that C++ class to C, and that could be a huge chore.

I clicked on the C along the top, and found the C API....
Mmm, interesting....

I solved it in the easy way. I call a shell script from within my program.

The problem is solved but not in the "C way" which it is the purpose of this forum. I guess that following the hint that Salem write down it could be possible, but I have not time to research about it. If somebody wants to solve it, the challenge is still here.

Thanks everybody.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.