LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2017, 08:53 AM   #1
Pereubu
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Rep: Reputation: Disabled
Porting from Microsoft studio VC ++ to Linux


How transfer cpp file with const string international characters in C from Microsoft Studio to Linux. Let say that I have a file with international latin1 characters. Let say that I have transferred file to UTF-8 and then to Linux...

Do I need to perform command: dos2unix mzCfile.cpp? On my utf-8 cpp file? Because my file is in UTF-8, do I need this command

I know that in MS VC++ File-Advanced Save with "Line endings" as an option to choose UNIX(LF). When I did it on MS VC++ side, my cpp utf-8 file looks as it is written in only one line? International characters looks good...

What I want is to have file I could do cat command and see string of international charaters as it should be and then compile it and run...
 
Old 08-01-2017, 08:58 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,504

Rep: Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866Reputation: 2866
Quote:
Originally Posted by Pereubu View Post
Do I need to perform command: dos2unix mzCfile.cpp?

I know that in MS VC++ File-Advanced Save with "Line endings" as an option to choose UNIX(LF). When I did it on MS VC++ side, my cpp utf-8 file looks as it is written in only one line?
On Windows, text files have carriage return characters (\r) as the second last character of each line. Those two operations do the same thing: strip those line-ending carriage return characters out. They have nothing to do with UTF-8 encoding.

The UTF-8 encoded stuff should be left alone because Linux supports UTF-8.
 
1 members found this post helpful.
Old 08-01-2017, 12:48 PM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,235

Rep: Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979
Converting line-ends from CRLF to LF is trivial.
Migrating programs between platforms is not always impossible, but always tricky.
Converting programs from ISO-8859-1 to UTF-8 can be problematic, trivial example:
Code:
fputc (stdout, 'ő'); // works in iso-8859-2
fputc (stdout, 'ő'); // doesn't work in utf8, as it is a two-byte sequence
 
Old 08-02-2017, 07:58 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,444
Blog Entries: 4

Rep: Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896Reputation: 2896
... and, so far as I recall, the gcc compiler suite is already savvy about source-code line endings . . .
 
Old 08-02-2017, 08:37 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,235

Rep: Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979
Encodings, on the other hand, might cause problems with gcc. If the original source is in windows-1252, then I suggest not to convert it right now, instead use gcc with these options: -finput-charset=windows-1252 -fexec-charset=windows-1252
 
  


Reply

Tags
c++ compiler


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Microsoft Visual Studio Code for Linux. What do you think? LXer Syndicated Linux News 0 05-04-2015 12:42 AM
Looking for linux equivalent of __cpuid() intrinsic (porting from Visual Studio) Mr_Nuke Programming 10 02-24-2009 05:40 PM
Is linux compatible with Microsoft's Visual Studio 8? tjsnyders Programming 2 03-06-2007 11:42 AM
Problems when porting code from C++ under visual studio 6 to linux. Stor_G Programming 3 08-26-2004 07:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration