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 ) & 0x3f );
}
else {
szOut[i++] = 0xe0 | (( *w ) >> 12 );
szOut[i++] = 0×80 | (( ( *w ) >> 6 ) & 0x3f );
szOut[i++] = 0×80 | (( *w ) & 0x3f );
} }
szOut[ i ] = ‘\0‘;
return ( char* )szOut;
}
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 [...]
[...] örneğini buradan [...]
[...] Use the “pre” tag and add the programming language you want to use as a parameter. Example:. < pre lang=”php” > your code here … < /pre >. for example: <pre lang=”php”> function hello_world(){ echo “hello world” }</pre> after highlighting: You can see a Living demo at here. [...]