PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 13, 2022

[FIXED] How to deal with newline char across different platforms

 September 13, 2022     communication, cross-platform, newline, text-editor     No comments   

Issue

I have a Linux system and Windows system send text to each other and each one of them update a text file with the received text, now i have a problem when the text contain LF/CR char, i need to unify the newline char sent by both of them, i tried to use only \n (replacing \r by empty string before sending the string) but it doesn't work , is there a known solution for this issue ?


Solution

Don't unifying, just accommodate for it in every environment, like Git does.

When sending from Windows to Linux replace \r\n "CRLF" with \n "LF" and vice versa, when sending from Linux to Windows convert \n to \r\n.



Answered By - Tamim Al Manaseer
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing