charencoding

"B. Kamer" <[email protected]> Fri, 6 May 2005 15:42:04 +0200
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
hi,

with the new encoding sceme in bc i am having a bit off trouble  
merging bc and legacy code. I would basicly have like to have you  
input wheter the following is possible (it seems to work) or perhaps  
i am thinking to simple here. Ofcourse the i18n conf has iso-8859-1  
as encoding.

basicly the question would be is switching of internal encoding  
allowed in this way. Are existing globals/vars converted  
automatically or are they left alone... are there any obvious  
considerations.

thanks a lot!

my htdocs file now look like...

// first!
require_once('../binarycloud.php');
include_once('init/Jazzserver_Project.php');
$project =& Jazzserver_Project::getInstance();
$project->startup();

// switch to legacy code encoding, bc has set it to UTF-8
iconv_set_encoding("internal_encoding", "iso-8859-1");
// capture any output generated by legacy code
ob_start();

// do legacy outputting
// old code is included, own db connections etc... (session is  
handled by bc, and later on auth will be too)

// capture that output (which is iso-8859-1)
$output = ob_get_clean();

// switch to bc encoding, cause it need to do somethings
iconv_set_encoding("internal_encoding", "utf-8");
$project->shutdown();

// bc is done... now switch back to my custom encoding
iconv_set_encoding("internal_encoding", "iso-8859-1");
echo $output;

$debug =& Debug::getInstance();
echo $debug->getOutput();

_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev