JS and CSS files in vagrant not properly encoded when saved outside of the VM

I had this problem this morning. Set EnableSendfile to off in your httpd.conf. If you look at your httpd.conf it says “turn this off if you serve from NFS-mounted filesystems.” In http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile it explains that “By default, when the handling of a request requires no access to the data within a file — for example, … Read more

Ruby on Rails 3, incompatible character encodings: UTF-8 and ASCII-8BIT with i18n

Ok so problem solved after some hours of googling… There was actually two bugs in my code. The first one was a file encoding error and the second was the problem with the MySQL Data base configuration. First, to solve the error caused by MySQL I used this two articles : http://www.dotkam.com/2008/09/14/configure-rails-and-mysql-to-support-utf-8/ http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/ Second, to … Read more

Convert an int value to unicode

In Python 2 – Turn it into a string first, then into unicode. str(integer).decode(“utf-8”) Best way I think. Works with any integer, plus still works if you put a string in as the input. Updated edit due to a comment: For Python 2 and 3 – This works on both but a bit messy: str(integer).encode(“utf-8”).decode(“utf-8”)

UTF8 vs. UTF16 vs. char* vs. what? Someone explain this mess to me!

Check out Joel Spolsky’s The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) EDIT 20140523: Also, watch Characters, Symbols and the Unicode Miracle by Tom Scott on YouTube – it’s just under ten minutes, and a wonderful explanation of the brilliant ‘hack’ that is UTF-8

What is the most efficient binary to text encoding?

This really depends on the nature of the binary data, and the constraints that “text” places on your output. First off, if your binary data is not compressed, try compressing before encoding. We can then assume that the distribution of 1/0 or individual bytes is more or less random. Now: why do you need text? … Read more

C programming: How can I program for Unicode?

C99 or earlier The C standard (C99) provides for wide characters and multi-byte characters, but since there is no guarantee about what those wide characters can hold, their value is somewhat limited. For a given implementation, they provide useful support, but if your code must be able to move between implementations, there is insufficient guarantee … Read more

How to set character_set_database and collation_database to utf8 in my.ini?

This actually isn’t a setting in the my.cnf (or my.ini in this case). mySQL gets this setting from the database’s own collation (when it was created). Inorder to get this inline with the utf8 encoding you want, do this: ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci; then do a restart on mysql (cant remember … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)