[TYPO3-core] RFC: Respect target if specified in file header

Martin Kutschker Martin.Kutschker at blackbox.net
Thu Dec 1 22:14:15 CET 2005


Michael Stucki <michael at typo3.org> writes on 
Thu, 01 Dec 2005 21:34:01 +0100 (MET):

> Hi Martin,
> 
> >> - The five-line detection works but is ugly. If anybody has a
> > > better
> >> way for this, please let me know.
> > 
> > UTF-8 can be auto-detected. If no charset is found with your
> > detection you
> > could try again with an UTF-8 detector. If there is interest I'll
> > write a routine for t3lib_cs.
> 
> Just for me to know: How can it be detected?
> If it's not too much work, such a feature would be nice.


Well, you can try and see if it is valid UTF-8. UTF-8 has rather distinct byte pattern. So if a test says it's UTF-8 it very likely is unless there are only 7-bit chars in the tested string.

PHP's mbstring has a function that tests for UTF-8 and here is a regexp that tests for UTF-8

http://www.w3.org/International/questions/qa-forms-utf-8.html


> >> - The character set lookup is based on a regular expression that
> > > can> be extended easily.
> > 
> > Could you move the charset detection in a separate function? The
> > function
> > should take a string as argument, so it can be used from other
> > code.
> 
> Is there a need for that? Otherwise I would wait with that. t3lib_div
> grows more and more...


How about makeing a t3lib_util.php?

Logically it belongs more to t3lib_cs but this class also shouldn't grow too large. Hm, a t3lib_cs_utils?


> >> - I did not find any examples but fear that there are calls of
> > > these
> >> functions where the CS conversion should be skipped. In this case,
> >> please change these functions and submit the $noCSconv parameter
> > > (see
> >> t3lib_div::getUrl() and t3lib_div::writeFile()).
> > 
> > I'm not quite happy with the current logic. IMHO auto-conversion
> > should
> > only be done when required. When turned on every single file request
> > will be slowed down.
> 
> I don't think it is a big slow-down, do you think so?


Yes I do. An dif understood Franz correctly he also argued for enabling manually by the admin.


> > But honestly I think an admin should know what he does an convert
> > all resources (db, files, etc).
> 
> It does not depend on the admin only. Trust me :-)


Maybe, but still this is an edge case and not normal.

Masi 



More information about the TYPO3-team-core mailing list