vs中保存的多字节字符集转成utf-8,as3接收utf-8字符串

  • Post author:
  • Post category:其他


vs中保存的多字节字符集转成utf-8
//转换文字ACP编码为Utf8编码
inline void ConvertACPToUtf8(TCHAR *szAcp, int nAcpLen, TCHAR *szUtf8, int nUtf8Len) 
{ 
	int len=MultiByteToWideChar(CP_ACP, 0, szAcp, -1, NULL,0); 
	unsigned short * wszUtf8 = new unsigned short[len+1]; 
	memset(wszUtf8, 0, len * 2 + 2); 
	MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)szAcp, -1, (LPWSTR)wszUtf8, len); 
	len = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)wszUtf8, -1, NULL, 0, NULL, NULL); 
	memset(szUtf8, 0, nUtf8Len); 
	if(len <= nUtf8Len)
	{
		WideCharToMultiByte (CP_UTF8, 0, (LPCWSTR)wszUtf8, -1, szUtf8, len, NULL,NULL); 
	}
	else
	{
		WideCharToMultiByte (CP_UTF8, 0, (LPCWSTR)wszUtf8, -1, szUtf8, nUtf8Len-1, NULL,NULL);
	}
	delete[] wszUtf8; 
}
//转换文字Utf8编码为ACP编码
inline void ConvertUtf8ToACP(TCHAR *szUtf8, int nUtf8Len,TCHAR *szAcp, int nAcpLen) 
{ 
	int len=MultiByteToWideChar(CP_UTF8, 0, (LPCTSTR)szUtf8, -1, NULL,0); 
	unsigned short * wszGBK = new unsigned short[len+1]; 
	memset(wszGBK, 0, len * 2 + 2); 
	MultiByteToWideChar(CP_UTF8, 0, (LPCTSTR)szUtf8, -1, (LPWSTR)wszGBK, len); 
	len = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)wszGBK, -1, NULL, 0, NULL, NULL); 

	memset(szAcp, 0, nAcpLen); 
	if(len <= nAcpLen)
	{
		WideCharToMultiByte (CP_ACP, 0, (LPWSTR)wszGBK, -1, szAcp, len, NULL,NULL); 
	}
	else
	{
		WideCharToMultiByte (CP_ACP, 0, (LPWSTR)wszGBK, -1, szAcp, nAcpLen-1, NULL,NULL); 
	}

	delete[] wszGBK; 
} 

as3接收utf-8字符串

//写入文本到内存字节流
function writeStringToByteArray(dst:ByteArray,val:String,length:uint):void
{
	var nValLen:int = val.length;
	dst.writeUTFBytes(val);
	for (var i:int = 0; i < (length - nValLen); i ++) {
		dst.writeByte(0);
	}
}
//读取文本从内存字节流
function readStringByByteArray(dst:ByteArray,length:uint):String
{
	if(length > (dst.length - dst.position))
		length =  dst.length - dst.position;
	return dst.readUTFBytes(length);
}

http://xiaozu.renren.com/xiaozu/102385/360404210

http://xiaozu.renren.com/xiaozu/102385/360404213

http://xiaozu.renren.com/xiaozu/102385/360404214

http://xiaozu.renren.com/xiaozu/102385/360404217

http://xiaozu.renren.com/xiaozu/102385/360404219

http://xiaozu.renren.com/xiaozu/102385/360404220

http://xiaozu.renren.com/xiaozu/102385/360404223

http://xiaozu.renren.com/xiaozu/102385/360404225

http://xiaozu.renren.com/xiaozu/102385/360404226

http://xiaozu.renren.com/xiaozu/102385/360404227

http://xiaozu.renren.com/xiaozu/102385/360404230

http://xiaozu.renren.com/xiaozu/102385/360404232

http://xiaozu.renren.com/xiaozu/102385/360404233

http://xiaozu.renren.com/xiaozu/102385/360404235

http://xiaozu.renren.com/xiaozu/102385/360404236

http://xiaozu.renren.com/xiaozu/102385/360404239

http://xiaozu.renren.com/xiaozu/102385/360404245

http://xiaozu.renren.com/xiaozu/102385/360404246

http://xiaozu.renren.com/xiaozu/102385/360404248

http://xiaozu.renren.com/xiaozu/102385/360404249

http://xiaozu.renren.com/xiaozu/102385/360404253

http://xiaozu.renren.com/xiaozu/102385/360404255

http://xiaozu.renren.com/xiaozu/102385/360404257

http://xiaozu.renren.com/xiaozu/102385/360404258

http://xiaozu.renren.com/xiaozu/102385/360404262

http://xiaozu.renren.com/xiaozu/102385/360404264

http://xiaozu.renren.com/xiaozu/102385/360404267

http://xiaozu.renren.com/xiaozu/102385/360404269

http://xiaozu.renren.com/xiaozu/102385/360404272

http://xiaozu.renren.com/xiaozu/102385/360404275

http://xiaozu.renren.com/xiaozu/102385/360404277

http://xiaozu.renren.com/xiaozu/102385/360404278

http://xiaozu.renren.com/xiaozu/102385/360404279

http://xiaozu.renren.com/xiaozu/102385/360404280

http://xiaozu.renren.com/xiaozu/102385/360404283

http://xiaozu.renren.com/xiaozu/102385/360404285

http://xiaozu.renren.com/xiaozu/102385/360404286

http://xiaozu.renren.com/xiaozu/102385/360404289

http://xiaozu.renren.com/xiaozu/102385/360404291

http://xiaozu.renren.com/xiaozu/102385/360404294

http://xiaozu.renren.com/xiaozu/102385/360404296

http://xiaozu.renren.com/xiaozu/102385/360404298

http://xiaozu.renren.com/xiaozu/102385/360404299

http://xiaozu.renren.com/xiaozu/102385/360404300

http://xiaozu.renren.com/xiaozu/102385/360404302

http://xiaozu.renren.com/xiaozu/102385/360404303

http://xiaozu.renren.com/xiaozu/102385/360404304

http://xiaozu.renren.com/xiaozu/102385/360404306

http://xiaozu.renren.com/xiaozu/102385/360404307

http://xiaozu.renren.com/xiaozu/102385/360404309

http://xiaozu.renren.com/xiaozu/102385/360404310

http://xiaozu.renren.com/xiaozu/102385/360404311

http://xiaozu.renren.com/xiaozu/102385/360404314

http://xiaozu.renren.com/xiaozu/102385/360404316

http://xiaozu.renren.com/xiaozu/102385/360404317

http://xiaozu.renren.com/xiaozu/102385/360404318

http://xiaozu.renren.com/xiaozu/102385/360404320

http://xiaozu.renren.com/xiaozu/102385/360404323

http://xiaozu.renren.com/xiaozu/102385/360404325

http://xiaozu.renren.com/xiaozu/102385/360404326

http://xiaozu.renren.com/xiaozu/102385/360404327

http://xiaozu.renren.com/xiaozu/102385/360404329

http://xiaozu.renren.com/xiaozu/102385/360404331

http://xiaozu.renren.com/xiaozu/102385/360404332

http://xiaozu.renren.com/xiaozu/102385/360404334

http://xiaozu.renren.com/xiaozu/102385/360404335

http://xiaozu.renren.com/xiaozu/102385/360404337

http://xiaozu.renren.com/xiaozu/102385/360404340

http://xiaozu.renren.com/xiaozu/102385/360404341

http://xiaozu.renren.com/xiaozu/102385/360404342

http://xiaozu.renren.com/xiaozu/102385/360404346

http://xiaozu.renren.com/xiaozu/102385/360404348

http://xiaozu.renren.com/xiaozu/102385/360404350

http://xiaozu.renren.com/xiaozu/102385/360404352

http://xiaozu.renren.com/xiaozu/102385/360404354

http://xiaozu.renren.com/xiaozu/102385/360404356

http://xiaozu.renren.com/xiaozu/102385/360404357

http://xiaozu.renren.com/xiaozu/102385/360404358

http://xiaozu.renren.com/xiaozu/102385/360404360

http://xiaozu.renren.com/xiaozu/102385/360404363

http://xiaozu.renren.com/xiaozu/102385/360404364

http://xiaozu.renren.com/xiaozu/102385/360404366

http://xiaozu.renren.com/xiaozu/102385/360404369

http://xiaozu.renren.com/xiaozu/102385/360404371

http://xiaozu.renren.com/xiaozu/102385/360404372

http://xiaozu.renren.com/xiaozu/102385/360404375

http://xiaozu.renren.com/xiaozu/102385/360404378

http://xiaozu.renren.com/xiaozu/102385/360404379

http://xiaozu.renren.com/xiaozu/102385/360404382

http://xiaozu.renren.com/xiaozu/102385/360404383

http://xiaozu.renren.com/xiaozu/102385/360404384

http://xiaozu.renren.com/xiaozu/102385/360404388

http://xiaozu.renren.com/xiaozu/102385/360404391

http://xiaozu.renren.com/xiaozu/102385/360404392

http://xiaozu.renren.com/xiaozu/102385/360404393

http://xiaozu.renren.com/xiaozu/102385/360404397

http://xiaozu.renren.com/xiaozu/102385/360404399

http://xiaozu.renren.com/xiaozu/102385/360404400

http://xiaozu.renren.com/xiaozu/102385/360404401

http://xiaozu.renren.com/xiaozu/102385/360404404

http://xiaozu.renren.com/xiaozu/102385/360404406

http://xiaozu.renren.com/xiaozu/102385/360404409

http://xiaozu.renren.com/xiaozu/102385/360404410

http://xiaozu.renren.com/xiaozu/102385/360404413

http://xiaozu.renren.com/xiaozu/102385/360404416

http://xiaozu.renren.com/xiaozu/102385/360404417

http://xiaozu.renren.com/xiaozu/102385/360404420

http://xiaozu.renren.com/xiaozu/102385/360404421

http://xiaozu.renren.com/xiaozu/102385/360404424

http://xiaozu.renren.com/xiaozu/102385/360404425

http://xiaozu.renren.com/xiaozu/102385/360404427

http://xiaozu.renren.com/xiaozu/102385/360404431

http://xiaozu.renren.com/xiaozu/102385/360404434

http://xiaozu.renren.com/xiaozu/102385/360404436

http://xiaozu.renren.com/xiaozu/102385/360404437

http://xiaozu.renren.com/xiaozu/102385/360404439

http://xiaozu.renren.com/xiaozu/102385/360404441

http://xiaozu.renren.com/xiaozu/102385/360404442

http://xiaozu.renren.com/xiaozu/102385/360404445

http://xiaozu.renren.com/xiaozu/102385/360404446

http://xiaozu.renren.com/xiaozu/102385/360404448

http://xiaozu.renren.com/xiaozu/102385/360404450

http://xiaozu.renren.com/xiaozu/102385/360404451

http://xiaozu.renren.com/xiaozu/102385/360404453

http://xiaozu.renren.com/xiaozu/102385/360404454

http://xiaozu.renren.com/xiaozu/102385/360404458

http://xiaozu.renren.com/xiaozu/102385/360404460

http://xiaozu.renren.com/xiaozu/102385/360404461

http://xiaozu.renren.com/xiaozu/102385/360404464

http://xiaozu.renren.com/xiaozu/102385/360404467

http://xiaozu.renren.com/xiaozu/102385/360404471

http://xiaozu.renren.com/xiaozu/102385/360404473

http://xiaozu.renren.com/xiaozu/102385/360404476

http://xiaozu.renren.com/xiaozu/102385/360404478

http://xiaozu.renren.com/xiaozu/102385/360404479

http://xiaozu.renren.com/xiaozu/102385/360404481

http://xiaozu.renren.com/xiaozu/102385/360404484

http://xiaozu.renren.com/xiaozu/102385/360404487

http://xiaozu.renren.com/xiaozu/102385/360404488

http://xiaozu.renren.com/xiaozu/102385/360404492

http://xiaozu.renren.com/xiaozu/102385/360404496

http://xiaozu.renren.com/xiaozu/102385/360404495

http://xiaozu.renren.com/xiaozu/102385/360404497

http://xiaozu.renren.com/xiaozu/102385/360404498

http://xiaozu.renren.com/xiaozu/102385/360404499

http://xiaozu.renren.com/xiaozu/102385/360404501

http://xiaozu.renren.com/xiaozu/102385/360404503

http://xiaozu.renren.com/xiaozu/102385/360404506

http://xiaozu.renren.com/xiaozu/102385/360404507

http://xiaozu.renren.com/xiaozu/102385/360404516

http://xiaozu.renren.com/xiaozu/102385/360404517

http://xiaozu.renren.com/xiaozu/102385/360404520

http://xiaozu.renren.com/xiaozu/102385/360404522

http://xiaozu.renren.com/xiaozu/102385/360404526

http://xiaozu.renren.com/xiaozu/102385/360404529

http://xiaozu.renren.com/xiaozu/102385/360404530

http://xiaozu.renren.com/xiaozu/102385/360404532

http://xiaozu.renren.com/xiaozu/102385/360404533

http://xiaozu.renren.com/xiaozu/102385/360404539

http://xiaozu.renren.com/xiaozu/102385/360404540

http://xiaozu.renren.com/xiaozu/102385/360404545

http://xiaozu.renren.com/xiaozu/102385/360404546

http://xiaozu.renren.com/xiaozu/102385/360404548

http://xiaozu.renren.com/xiaozu/102385/360404552

http://xiaozu.renren.com/xiaozu/102385/360404553

http://xiaozu.renren.com/xiaozu/102385/360404555

http://xiaozu.renren.com/xiaozu/102385/360404556

http://xiaozu.renren.com/xiaozu/102385/360404558

http://xiaozu.renren.com/xiaozu/102385/360404559

http://xiaozu.renren.com/xiaozu/102385/360404560

http://xiaozu.renren.com/xiaozu/102385/360404565

http://xiaozu.renren.com/xiaozu/102385/360404567

http://xiaozu.renren.com/xiaozu/102385/360404568

http://xiaozu.renren.com/xiaozu/102385/360404569

http://xiaozu.renren.com/xiaozu/102385/360404572

http://xiaozu.renren.com/xiaozu/102385/360404576

http://xiaozu.renren.com/xiaozu/102385/360404577

http://xiaozu.renren.com/xiaozu/102385/360404580

http://xiaozu.renren.com/xiaozu/102385/360404582

http://xiaozu.renren.com/xiaozu/102385/360404584

http://xiaozu.renren.com/xiaozu/102385/360404590

http://xiaozu.renren.com/xiaozu/102385/360404591

http://xiaozu.renren.com/xiaozu/102385/360404593

http://xiaozu.renren.com/xiaozu/102385/360404598

http://xiaozu.renren.com/xiaozu/102385/360404600

http://xiaozu.renren.com/xiaozu/102385/360404601

http://xiaozu.renren.com/xiaozu/102385/360404603

http://xiaozu.renren.com/xiaozu/102385/360404605

http://xiaozu.renren.com/xiaozu/102385/360404609

http://xiaozu.renren.com/xiaozu/102385/360404610

http://xiaozu.renren.com/xiaozu/102385/360404611

http://xiaozu.renren.com/xiaozu/102385/360404614

http://xiaozu.renren.com/xiaozu/102385/360404615

http://xiaozu.renren.com/xiaozu/102385/360404616

http://xiaozu.renren.com/xiaozu/102385/360404618

http://xiaozu.renren.com/xiaozu/102385/360404621

http://xiaozu.renren.com/xiaozu/102385/360404622

http://xiaozu.renren.com/xiaozu/102385/360404626

http://xiaozu.renren.com/xiaozu/102385/360404629

http://xiaozu.renren.com/xiaozu/102385/360404631

http://xiaozu.renren.com/xiaozu/102385/360404632

http://xiaozu.renren.com/xiaozu/102385/360404635

http://xiaozu.renren.com/xiaozu/102385/360404636

http://xiaozu.renren.com/xiaozu/102385/360404639

http://xiaozu.renren.com/xiaozu/102385/360404643

http://xiaozu.renren.com/xiaozu/102385/360404644

http://xiaozu.renren.com/xiaozu/102385/360404645

http://xiaozu.renren.com/xiaozu/102385/360404646

http://xiaozu.renren.com/xiaozu/102385/360404648

http://xiaozu.renren.com/xiaozu/102385/360404650

http://xiaozu.renren.com/xiaozu/102385/360404653

http://xiaozu.renren.com/xiaozu/102385/360404658

http://xiaozu.renren.com/xiaozu/102385/360404659

http://xiaozu.renren.com/xiaozu/102385/360404660

http://xiaozu.renren.com/xiaozu/102385/360404664

http://xiaozu.renren.com/xiaozu/102385/360404665

http://xiaozu.renren.com/xiaozu/102385/360404667

http://xiaozu.renren.com/xiaozu/102385/360404669

http://xiaozu.renren.com/xiaozu/102385/360404671

http://xiaozu.renren.com/xiaozu/102385/360404674

http://xiaozu.renren.com/xiaozu/102385/360404677

http://xiaozu.renren.com/xiaozu/102385/360404681

http://xiaozu.renren.com/xiaozu/102385/360404682

http://xiaozu.renren.com/xiaozu/102385/360404685

http://xiaozu.renren.com/xiaozu/102385/360404686

http://xiaozu.renren.com/xiaozu/102385/360404687

http://xiaozu.renren.com/xiaozu/102385/360404688

http://xiaozu.renren.com/xiaozu/102385/360404691

http://xiaozu.renren.com/xiaozu/102385/360404692

http://xiaozu.renren.com/xiaozu/102385/360404696

http://xiaozu.renren.com/xiaozu/102385/360404698

http://xiaozu.renren.com/xiaozu/102385/360404700

http://xiaozu.renren.com/xiaozu/102385/360404701

http://xiaozu.renren.com/xiaozu/102385/360404704

http://xiaozu.renren.com/xiaozu/102385/360404706

http://xiaozu.renren.com/xiaozu/102385/360404707

http://xiaozu.renren.com/xiaozu/102385/360404709

http://xiaozu.renren.com/xiaozu/102385/360404715

http://xiaozu.renren.com/xiaozu/102385/360404716

http://xiaozu.renren.com/xiaozu/102385/360404717

http://xiaozu.renren.com/xiaozu/102385/360404719

http://xiaozu.renren.com/xiaozu/102385/360404722

http://xiaozu.renren.com/xiaozu/102385/360404726

http://xiaozu.renren.com/xiaozu/102385/360404728

http://xiaozu.renren.com/xiaozu/102385/360404732

http://xiaozu.renren.com/xiaozu/102385/360404733

http://xiaozu.renren.com/xiaozu/102385/360404737

http://xiaozu.renren.com/xiaozu/102385/360404741

http://xiaozu.renren.com/xiaozu/102385/360404742

http://xiaozu.renren.com/xiaozu/102385/360404743

http://xiaozu.renren.com/xiaozu/102385/360404747

http://xiaozu.renren.com/xiaozu/102385/360404749

http://xiaozu.renren.com/xiaozu/102385/360404750

http://xiaozu.renren.com/xiaozu/102385/360404754

http://xiaozu.renren.com/xiaozu/102385/360404757

http://xiaozu.renren.com/xiaozu/102385/360404758

http://xiaozu.renren.com/xiaozu/102385/360404760

http://xiaozu.renren.com/xiaozu/102385/360404763

http://xiaozu.renren.com/xiaozu/102385/360404764

http://xiaozu.renren.com/xiaozu/102385/360404766

http://xiaozu.renren.com/xiaozu/102385/360404768

http://xiaozu.renren.com/xiaozu/102385/360404771

http://xiaozu.renren.com/xiaozu/102385/360404774

http://xiaozu.renren.com/xiaozu/102385/360404775

http://xiaozu.renren.com/xiaozu/102385/360404778

http://xiaozu.renren.com/xiaozu/102385/360404785

http://xiaozu.renren.com/xiaozu/102385/360404787

http://xiaozu.renren.com/xiaozu/102385/360404790

http://xiaozu.renren.com/xiaozu/102385/360404793

http://xiaozu.renren.com/xiaozu/102385/360404796

http://xiaozu.renren.com/xiaozu/102385/360404799

http://xiaozu.renren.com/xiaozu/102385/360404801

http://xiaozu.renren.com/xiaozu/102385/360404803

http://xiaozu.renren.com/xiaozu/102385/360404806

http://xiaozu.renren.com/xiaozu/102385/360404807

http://xiaozu.renren.com/xiaozu/102385/360404809

http://xiaozu.renren.com/xiaozu/102385/360404812

http://xiaozu.renren.com/xiaozu/102385/360404815

http://xiaozu.renren.com/xiaozu/102385/360404819

http://xiaozu.renren.com/xiaozu/102385/360404820

http://xiaozu.renren.com/xiaozu/102385/360404821

http://xiaozu.renren.com/xiaozu/102385/360404827

http://xiaozu.renren.com/xiaozu/102385/360404828

http://xiaozu.renren.com/xiaozu/102385/360404830

http://xiaozu.renren.com/xiaozu/102385/360404833

http://xiaozu.renren.com/xiaozu/102385/360404835

http://xiaozu.renren.com/xiaozu/102385/360404837

http://xiaozu.renren.com/xiaozu/102385/360404839

http://xiaozu.renren.com/xiaozu/102385/360404843

http://xiaozu.renren.com/xiaozu/102385/360404850

http://xiaozu.renren.com/xiaozu/102385/360404851

http://xiaozu.renren.com/xiaozu/102385/360404852

http://xiaozu.renren.com/xiaozu/102385/360404854

http://xiaozu.renren.com/xiaozu/102385/360404856

http://xiaozu.renren.com/xiaozu/102385/360404857

http://xiaozu.renren.com/xiaozu/102385/360404858

http://xiaozu.renren.com/xiaozu/102385/3604



版权声明:本文为shldesky原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。