Skip to main content
John Brandenburg

Main navigation

  • Home
  • About Me
  • Tech
  • Voting Rights
    • Close Polling Stations:
    • Reject Absentee Ballots
    • 482,000 de-registered voters in Wisconsin since 2016
    • Deceptive Practices by poll workers
    • Gerrymandering
    • Lack of Early Voting
    • Purge Voters
    • Removing Voting Rights from Former Felons
    • Unreliable Voting Equipment
    • Voter ID Laws
User account menu
  • Log in

Breadcrumb

  1. Home

Be careful with copy paste: Encoding hell

By John, 20 January, 2017

I shouldn't have to say this to the type of person who follows this site, which is mostly myself, and a bunch of trump supporting Russians that speak very strange languages... but here is a reminder to be careful when copy-pasting code, especially from comments/descriptions from a ticketing system. Depending on your operating system, the following lines will look identical, but there is a subtle difference. 


  if (true) {
    $foo = 'bar';
  }

  if (true) {
    
$foo = 'bar';
  }

I know Linux users will likely see the error right away because of the characters that OS usually handles. The error is in the second if statement. It uses U+2028 (LINE SEPARATOR), instead of a regular line feed.  U+000a.

Lesson learned... again. It's always a good practice to re-type code. If anything, it is good practice in thoroughly examining the code instead of whole-sale copy-pasting. 

Tags

  • Tech
RSS feed
Powered by Drupal