Archive for March, 2007

GMENU/GIFBUILDER broke my swedish characters

Thursday, March 8th, 2007

We’ve been working on a site for a customer for some time now based on TYPO3. As the the respect to typographical issues where important we decided to go forth using GMENU and GIFBUILDER for menus and headings. I really like the concept of GIFBUILDER and working with it. Sadly we got problems with non ascii characters like our swedish åäö and such. They where replaced by ugly boxes.

Character Ö is replaced by a box..

So, why on earth did this happend I questioned my self.. and people on #typo3 @ irc.freenode.org.

I ended up with these suggestions/requirements:

  1. Make sure you use utf-8 all the way. Gifbuilder (probably GD/freetype really)
  2. Check that the font you use is unicode
  3. Check configuration for mbstring (or iconv) that gifbuilder uses

I did all this. Utf-8 was a requirement for the project as the site will be on both chinese, swedish and english. The font seemed to be in Unicode as well (as far as I could tell). And mbstring was working like a charm..

It’s importent to mention that the development server was a windows server.

Anyway. I copied the site to my local windows computer and tested it. The same buggy result. The I copied it to my own webserver running on debian linux and there it worked! Why? Donno.. However. I went back to my local computer and replaced the font with arial. I got nifty åäö all the sudden. This at least allowed me to assume that it had something to do with the font file (a .otf file btw). The only solution I could think of now would be to convert the font hopfully to utf-8. I got merely no experience with typographical things so this was a blank area for me, but after som googleing I stumbled upon fontforge (http://fontforge.sf.net). It’s actually a *NIX application but I installed Cygwin (along with xfce4), and the cygwin port of fontforge. Wow what an app! A really crappy gui, but wow! :)

fontforge with cygwin

So, I went on and converted my .otf font forcing it to Full unicode, replaced it in my exsisting font on the site. It worked like a charm!

My final configuration on every aspect turned out like this:

localconf.php:

  1.  
  2. // UTF-8 support
  3. $TYPO3_CONF_VARS[‘GFX’][‘gdlib_2′] = ’1′;
  4. $TYPO3_CONF_VARS[‘BE’][‘forceCharset’] = ‘utf-8′
  5. // For GIFBUILDER support
  6. // Set it to ‘iconv’ or ‘mbstring’
  7. $TYPO3_CONF_VARS[‘SYS’][‘t3lib_cs_convMethod’] = ‘mbstring’;
  8. // For ‘iconv’ support you need PHP 5!
  9. $TYPO3_CONF_VARS[‘SYS’][‘t3lib_cs_utils’] = ‘mbstring’;
  10. // For Asian languages
  11. $TYPO3_CONF_VARS[‘SYS’][‘multiplyDBfieldSize’] = 3;
  12. //force db communication to utf8
  13. $TYPO3_CONF_VARS[‘SYS’][‘setDBinit’] = ‘SET NAMES utf8;’;
  14.  

Typoscript

  1.  
  2.  
  3. ## GIFBUILDER HEADING RENDER SETUP ########
  4. ##
  5. ##### Header 1
  6. cHeader1 = IMAGE
  7. cHeader1 {
  8.     alttext.cObject = TEXT
  9.     alttext.cObject.field = header
  10.     wrap = <div class="h1gfx">|</div>
  11.     file = GIFBUILDER
  12.     file {
  13.         format = gif
  14.         reduceColors = 15
  15.         transparentColor = #ffffff
  16.         XY = [10.w]+2,[10.h]+8
  17.         backColor = #ffffff
  18.         10 = TEXT
  19.         10 {
  20.     text.field = header
  21.     fontSize = 14
  22.     offset = 0,20
  23.     fontColor = #333333
  24.     fontFile = fileadmin/fonts/NewsGothicStd_utffull.ttf
  25.     antiAlias = 1
  26.     value.case = upper
  27.         }
  28.     }
  29. }
  30.  

Database was set to full utf-8 charset in all tables from the beginning.

See http://wiki.typo3.org/index.php/UFT-8_support about utf-8 support for TYPO3.

Delphi for PHP, a promising PHP RAD

Thursday, March 1st, 2007

I just recently found out about Delphi for PHP – a PHP RAD environment. Actually the first real PHP RAD environment I’ve seen. Delphi was (and still is I guess) a fast and easy to use RAD for MS Windows solutions based on the the Pascal language. I more or less started my programming path with Delphi so there are special feelings still there for it :)

Delphi for PHP can be found at http://www.codegear.com/products/delphiforphp. Take a sneak peak at the demos. I really like the table grid and database connection.

I think that a RAD like Delphi for PHP is a great thing for the PHP language though not required. But developing complex, custom tailored solutions for your clients by hand is time consuming and demanding even if you use frameworks like cakePHP or symfony (which both are really great btw). Using some kind of IDE like eclipse (with php plugin), PSPad or JEdit is a requirement for any development.

What I fear is that I might loose to much control over the source code and it’s parts. To much happening automaticaly. A bit like using Microsofts development tools ;) . I’m also a bit worried when using proprietary libraries like the vcls as I can’t enhance or redefine them in the same way as with open source ones. The good thing here on the other hand is that these libraries are object oriented and therefore easily extendible. Thinking of it, it would also be interesting to know a bit more about layout support and application flow controls.

Well I’m hoping to fetch a trial of it before I mumble to much about pros and cons. ;)

So please codegear. Release a trial version so we can give it a spinn. I’m definitely considering to start use it. If it can increase productivity and efficiency, while still leaving me with full control over my sources it’s worth a lot. I’m ready to let go of total control and “notepad mentality” in benefit of that. Maybe I might actually be able to start earn some money on the projects then.