UTF-8 filenames under Windows / PHP

If you read this, probably you have problems with files with names containing unicode characters.

My scenario was simple:

  1. User uploads own file with unicode characters (ex. my_unicode_ąść.jpg)
  2. PHP handles the upload and moves uploaded file to a directory on your server and creates a database record with original filename(ex. my_unicode_ąść.jpg)
  3. Because lack of unicode support in PHP filename is saved with wrong encoding (multibyte string is split into one-byte characters, which in case of unicode multibyte encoding renders wrong, ex. my_unicode_ść.jpg)
  4. Any future call using database stored name fails because two names are different.

To get rid of this problem I have used PHP UTF8 library.

It is as simple as that:

include("../utf8toascii/utf8_to_ascii.php");
utf8_to_ascii($_FILES['Filedata']['name'])

From now on, before working with filename, first we change any unicode character to it’s closest ASCII version.

We have to do this and patiently wait for PHP6 release, which promises native UFT-8 support.

Windows 7 full screen games problem.

If you own a computer with realtek audio chip, probably you experienced an issue with full screen games (like GTA:SA or NFS:MW).

My games, when ran fullscreen were minimizing every few seconds preventing me to play. No solution I found on the internet was working in my case so I decided to try my luck on my own.

After countless restarting / killing processes I could find a process which receives focus each few seconds causing my games minimize to desktop.

Malicious process name is:

RAVCpl64.exe

You have to kill that process in order to have uninterrupted gameplay, this saved me alot of time and allows me to play again my favourite games!

SA-MP 0.3d released!

Few days ago new version of SA:MP has been shared with us, here is a list of changes:

  • Support for Shoutcast/Icecast audio streams.
  • Major performance improvements and smoother game-play.
  • Improvements to sync, including vehicle passengering and motorbikes.
  • New models, including a replacement mall, hot air balloon, fireman hats.
  • You can surf on objects attached to moving objects and objects attached to vehicles.
  • Servers can remove static buildings from the map.
  • Moving objects can now rotate smoothly.
  • Many new scripting functions and callbacks for SA-MP servers.

From my point of view, synchronization is much improved in comparison to previous versions. Also interesting new features are support for shoutcast streams and removing static buildings from map – both can lead to totally new experience in GTA:SA world!

Looking forward to see gamemodes taking advantage of those new features, it will be interesting!

You can download it from here.