Convert Unicode To UTF8
{
const WCHAR* w;
// Convert unicode to utf8
int len = 0;
for ( w = wstr; *w; w++ ) {
if ( *w < 0×0080 ) len++;
else if ( *w < 0×0800 ) len += 2;
else len += 3;
}
unsigned char* szOut = ( unsigned char* )malloc( len+1 );
if ( szOut == NULL )
return NULL;
int i = 0;
for ( w = wstr; *w; w++ ) {
if ( *w < 0×0080 )
szOut[i++] = ( unsigned char ) *w;
else if ( *w < 0×0800 ) {
szOut[i++] = 0xc0 | (( *w ) >> 6 );
szOut[i++] = 0×80 | (( *w ) & 0×3f );
}
else {
szOut[i++] = 0xe0 | (( *w ) >> 12 );
szOut[i++] = 0×80 | (( ( *w ) >> 6 ) & 0×3f );
szOut[i++] = 0×80 | (( *w ) & 0×3f );
} }
szOut[ i ] = ‘\0‘;
return ( char* )szOut;
}
Thanjk good post.. thnx thnx
Is there any way to turn line number off, for a single <pre> block, or start line numbers at a certain number ?
realy good work, tnx a lot!
function num2str($inn, $stripkop=0) {
return implode(’ ‘,$out);
}
hfıy
let’s test it:
<?
$var = “10″;
for($i=0;$i
End!
Web sitenizde CSS, PHP, JS kod parçaları yayınlıyorsanız, bu kodların tek renk olarak görünmesinden sıkılmış olabilirsiniz. Özellikle uzun kod parçalarıyla verilen örneklerde kodların tek renkte olması, okunabilirliği ve kodun anlaşılabilirliğini oldukça azaltıyor.
realy good work, tnx a lot!
[...] Şu adreste çalışan halini [...]