Print Page | Close Window

IsUnicodeFile function is validate??

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Syntax Edit
Forum Description: Topics Related to Codejock Syntax Edit
URL: http://forum.codejock.com/forum_posts.asp?TID=10988
Printed Date: 11 December 2024 at 8:49pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: IsUnicodeFile function is validate??
Posted By: yayo
Subject: IsUnicodeFile function is validate??
Date Posted: 11 June 2008 at 4:15am
https://forum.codejock.com/uploads/20080611_041206_test.zip -
uploads/20080611_041206_test.zip
 
test file is general text not unicode!!
 
 
m_bUnicodeFileFormat = IsUnicodeFile(pFile);
 
==> unicode true return;
 
case 1:
 
AFX_INLINE BOOL IsUnicodeFile(CFile *pFile)
{
 pFile->SeekToBegin();
 // yayo write
 DWORD_PTR dwFileSize = (DWORD_PTR)pFile->GetLength();
 if(dwFileSize==4) // UNICODE는 파일 사이즈가 4가 나올수 없다. 일반 텍스트가 4바이트일때 유니코드로 취급된다 주의하길
  return FALSE;
 
 
case 2:
 
AFX_INLINE BOOL _IsUnicodeFile_heuristic(CFile *pFile)
{
 ...
 
 if (uDataXcount < 10)
 {
  // yayo write UNICODE 검출 힘들다.
  //return nVariation0 > nVariation1 || nSmallNumbers1;
  BOOL bUncode = nVariation0 > nVariation1 || nSmallNumbers1;
  if(bUncode&&IsTextUnicode((void*)arData, cnBufferSize, NULL))
   return TRUE;
  return FALSE;
 }
 ...
}
 
 


-------------
hi



Replies:
Posted By: yayo
Date Posted: 11 June 2008 at 8:29pm
hm~~!
the example(case1, case2) is my modified test code.
 


-------------
hi



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net