You are here: Home »

[ En ]

Category Archives: [ En ]

PHP email subject encoding

If you thought that setting “Content-Type” will suffice to make your email just send away without problems, think again. The specified character encoding in “Content-Type” will only describe the character encoding of the body, not the subject itself. If the subject contains UTF-8 chars your email subject will not look as expected on the recipient. To fix this issue you will need to use the encoded-word syntax (RFC2047#section-2) with either the quoted-printable encoding or the Base64 encoding.
Here is a quick snippet on how I did it:

1
2
3
4
if (strlen($subject) != strlen(utf8_decode($subject))) //check if subject is utf-8
       fwrite($socket, 'Subject: =?UTF-8?B?'.base64_encode(html_entity_decode(utf8_encode($subject), ENT_COMPAT, "UTF-8"))."?="."\r\n".'To: <'.implode('>, <', $recipients).'>'."\r\n".$headers."\r\n\r\n".$message."\r\n");
 else
       fwrite($socket, 'Subject: '.$subject."\r\n".'To: <'.implode('>, <', $recipients).'>'."\r\n".$headers."\r\n\r\n".$message."\r\n");

This syntax uses a string of ASCII characters indicating both the original char encoding and the content-transfer-encoding used to map the bytes of the charset into ASCII characters.
The syntax is: “=?charset?encoding?encoded text?=”.

As you can see above I’m trying to see if the “subject” string contains any UTF-8, so it will encode only when necessary. The encoding check I’m doing is fairly simple, and you can also use mb_check_encoding function to do the same thing. I didn’t use it because it requires php_mbstring extension loaded, which is a non-default extension (it is not enabled by default, you must explicitly enable the module in your php.ini).

I’m using fwrite because I’m actually writing/reading directly to sockets (working on a simple SMTP client in PHP). The same rule applies for the standard email php function: the encoded-word syntax is expected for the subject or other header field values if they contain UTF-8 chars (but not for the body).
If you are not happy with the base64 encoding you can use imap_8bit function for the quoted-printable encoding, like this:

1
$subject="=?UTF-8?Q?".imap_8bit($subject)."?=";

Hope this helps. Good luck!

You like this post? Be the first of my friends to give me a beer! click here. Thanks!
December 6, 2012 | | PHP, [ En ]

Comments Off

Google+ Invites For Free: Get’em Quick!

The new Google’s social networking site is up and running in beta stage for some time now, as you expected is invitation based. Scams are all over the net trying to make a buck out of this. Try searching amazon for example, $100 for a Google+ invitation, wtf? Are you for real? read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Subs Grabber project moved

  I’m not maintaining the Subs Grabber project anymore, all projects copyrights and feature updates will be released from now here. As you can see Subs Grabber sources have been sold, and it goes shareware from now on. I’m still using it for my personal use, is still a great subtitles tool but I don’t have sufficient time for this project, I’ve found an old friend who will take subs grabber to the next level, hope to succeed because it looks greater and useful with every release, I’m proud I’ve managed to start it, to bad I didn’t succeed in keep it here.

ps: Happy valentines day! :X

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

My Tweet Tools

  • BsTweet - BsPlayer plugin to automatically send a Twitter status update with your movie name when you play it. (nice one!)
  • TwitBin- a firefox extension that allows you to keep up with all of your Twitter conversations right from your browser sidebar. Send messages, receive messages, share links
  • Seesmic for Windows – Fully functional Twitter integration
    View aggregated Home, Replies, Private and Sent columns. Manage and post from multiple twitter accounts, create unlimited columns for your saved searches and lists created from Twitter.
  • Twitme – wordpress plugin to automatically post your new posts on the twitter.
You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Subs Grabber previews/tuts/how to etc

  Below are some video shots with the latest Subs Grabber “at work”, searching for subtitles, uploading subtitles and how the perfect match works ….
read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Subs Grabber update (v0.4.0)

   Subs Grabber Build v0.4.0.47 is out with new features, new subtitles servers and above all his own server where everyone can upload their subtitle linked with the video file. What’s “linked” thing you ask? Well it’s actually a unique hash/id that will identify your video/movie file you have. Based on that you can get a perfect match search result of a published subtitle, no more wasted time to match names, no more wasted clicks. You can now set your video file for a perfect match result, if you are not lucky enough and a perfect match is not found on our server SG will try to match video file name and folder with the search results from the other servers and highlight the ones matching. So, for best results give SG the file name/path as well ;)

Any way, hope you like it, here are the major changes, some screenshots and download link below:

What’s new

  • subtitrari.softpedia.com removed: they moved subtitles on forums, i tried to add support, asked for permission, i didn’t get it, they don’t want it, sorry :(
  • added more subtitles servers: anysubs.com, divxsubtitles.net, subtitrari.regielive.ro
  • added own server only for subtitles linked with the video file. You can now upload/publish subs and get lucky with a perfect match result when searching. Anyone is welcomed to help Subs Grabber grow by uploading subtitles along with the movie hash in any supported language. It’s easy to upload subs, SG will do everything for you, you just need to supply the video and subtitle files. Just register for an account from SG ->Upload tab and start uploading and enjoy the perfect match results :-) (please don’t modify the original subtitles, if you modify a subtitle to fit your needs keep the original author in place and add your self as the one who modify it along with the modify reason, authors deserves respect for their work )
  • added IMDb info grabber when uploading new subs
  • added more powerful shell extension when right clicking on a video file, you can right click and just start the search if you feel lucky, or upload subs to help Subs Grabber grow.
  • subtitles with name/details matching the movie file or folder name will be highlighted (names with red color)
  • Work still in progress, see http://subtitrari.raz-soft.com

read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Why do you need a buddy? (or the mass effect)

That’s why: read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Recovering…

 Time to “ping” my site :) Hi reader, how are you? Oh, you’re fine, me too, just busy coding and coding… My site is now on a new look, it got hacked by some bastard punk a few days back, didn’t notice the hack, they where some hidden links on my pages, google is not “visiting” me anymore because of that, it will be back on indexing me in a couple of days/weeks, who knows….
read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Subs Grabber Update (v0.2.26)

   – added new subtitles server: titrari.ro/subtitrari.ro
read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!

Subs Grabber

  Subs Grabber… a tool that i’ve started it long time ago but never got time to finish it, I’ve use it for myself for a while and now I think i should make it public for everyone who needs a subtitle searching tool. So, what’s Subs Grabber? is a simple application which allows you to download subtitles for your movies. With two clicks, one on your movie file and the second one on the search button, you’ll find your movie subtitle. Next thing you should do is just to sit back and enjoy the movie.

Main features:

    100% FREE AWARD

  • fastest search engine on 7 subtitles servers: subtitrari.raz-soft.com, subs.ro, titrari.ro / subtitrari.ro, divxsubtitles.net, anysubs.com, subtitrari.regielive.ro and podnapisi.net
  • display subtitle advanced info like No of CDs,FPS, Date, release name etc
  • mass subtitles grabbing
  • movie cover/poster on search results (ready to be grabbed as well)
  • automatically unpack subtitles after grabbing them (external unpacker required, winrar will be detected by default)
  • search for a subtitle in almost any language: Albanian, Arabic, Belarus, Bosnian, Bulgarian, Chinese, Croatian, Czech, Danish, Dutch, English, German, Hungarian, Italian, Japanese, Korean, Latvian, Norwegian, Polish, Portuguese, Portuguese Brazilian,Romanian, Russian, Serbian… and many more
  • upload new subtitles linked with video file on subtitrari.raz-soft.com
  • automatically IMDb movie info grabber when uploading new subtitles
  • windows explorer shell extension. When right clicking on a video file you can just start the search if you feel lucky, or upload subs to help SG grow. (optional)
  • easy to use and modern user interface with different visual styles
  • application is 100% clean, which means it does not contain any form of malware and is completely free!

read more

You like this post? Be the first of my friends to give me a beer! click here. Thanks!