Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Syntax Edit
  New Posts New Posts RSS Feed - IsUnicodeFile function is validate??
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

IsUnicodeFile function is validate??

 Post Reply Post Reply
Author
Message
yayo View Drop Down
Groupie
Groupie
Avatar

Joined: 22 December 2006
Location: Korea, South
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote yayo Quote  Post ReplyReply Direct Link To This Post Topic: IsUnicodeFile function is validate??
    Posted: 11 June 2008 at 4:15am
 
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
Back to Top
yayo View Drop Down
Groupie
Groupie
Avatar

Joined: 22 December 2006
Location: Korea, South
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote yayo Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2008 at 8:29pm
hm~~!
the example(case1, case2) is my modified test code.
 
hi
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.