Archive for October, 2013

UTF-8 encoded data corrupted in CSV exports

When exporting from PHPMyAdmin as CSV, Excel usually doesn’t know how to deal with the special characters, resulting in corrupted data.

csv_corruption

 

In order to avoid this, we use the following method:

  1. Open a new Excel book
  2. On the “Data” tab, click on the “From Text” button:
    data
  3. Locate your CSV file and click on “Import”
  4. In the dialog box, select the appropriate encoding (i.e. UTF-8) from the dropdown list:
    utf-8
  5. Next, select the delimiter for the CSV (i.e. comma):
    delimit
  6. Then click on Finish (you will be asked where to insert the data – normally [A1] is the place to put it).
  7. Now the data is correctly displayed in Excel:
    csv_fixed

PHP emailing script

This is a tested script for correctly sending emails via php:

<?php
$to      = '[email protected]';
$subject = 'This is the subject';
$message = 'Hello! this is the bottom text';
$headers = 'Content-type: text/html; charset="UTF-8"' . "\r\n" .
'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers,"[email protected]");
?>

Jason’s default .bashrc file

alias mv='mv -i'
alias df='df -h'
alias du='du -sh'
alias vi=vim
alias scp='scp -P 10022'
alias dir='ls -lah'
alias clearall='history -c;clear'
alias cleard='clear;dir'
alias servicerestart='service httpd restart && service mysqld restart && service vsftpd restart'
alias networkrestart='service iptables restart && service network restart'
alias ipconfig=ifconfig
alias version='cat /etc/redhat-release && uname -a'
alias cdh='cd /var/www/html/sites/www.ewea.org'
alias apachify='chown -R apache:apache . ; find ./ -type d -print -exec chmod 775 {} \;; find ./ -type f -print -exec chmod 664 {} \;'
alias send='rsync -avze "ssh -p 10022 -i /root/.ssh/main_prv_key"'
alias wgett='wget --page-requisites'