Gii template files encoding

Hi all,

I’m creating new set of gii tool templates with translation to my native language and some minor code layout fixes. And either I’m missing something or files located in yii\gii\generators\crud\templates\ (did not checked for other templates yet) are not encoded in utf-8.

I saw some garbage in files generated upon these templates and had to manually re-encode them (both templates and generated files) to utf-8. This fixed problem for me.

Has anyone else run into this?

This is the same situation you will experience changing any framework supplied file (e.g. view or message), adding customized characters that cannot be represented by 7-bit ascii.

/Tommy

That is actually not true. All view files generated by gii and all messages are perfectly encoded in utf-8. That is why I was surprised that gii base files are not. If in fact they are not - maybe there’s something with my NetBeans that particullary these files are badly encoded.

All I can tell you is that the files Yii generates for me are not different from the original format in the framework core (svn r2609). I doubt this would change even if you select your language before generating files. The files just aren’t saved as UTF-8, that’s your responsibility if you introduce character codes > 127 (presuming your intention was to use UTF-8).

Also check out this thread

/Tommy

Yeap! You’re 100% right! The problem is in NetBeans I use. Under Windows (don’t know if under Linux or other system too) if you open file that lies in a project main patch, all is OK. If you open the same file from additional (search path) you will see garbage.

That’s why I thought it’s gii related problem. I got all my project files opened from main path, where encoding was perfectly good, but I added Yii to search path, and files opened from there has messed-up encoding.

NetBeans saves each file in UTF-8 AFAIK. It only has problems when reading them form additional path.