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

Martin Kutschker Martin.Kutschker at blackbox.net
Thu Dec 1 18:55:14 CET 2005


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

> 
> Comments:
> 
> - 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.


> - 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.


> - 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.

As I see it, this conversion comes in handy, but should not be needed in normal circumstances. It's a hack/workaround for an incomplete conversion.

I'm not sure if a GLOBAL setting is the correct answer. This code uses the global setting unless an explicitely enable/disable parameter is used.

function writeFile($file,$content,$autoConvCS=null) {
if (is_null($autoConvCS)) {
$autoConvCS = $GLOBALS['TYPO3_VAR']['SYS']['fileCharsetAutoConcv'];
}
...
}

But honestly I think an admin should know what he does an convert all resources (db, files, etc).

-0

Masi





More information about the TYPO3-team-core mailing list