Page 1 of 1

hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Wed Apr 09, 2025 1:22 pm
by gurj
When the PBCHM is opened on Chinese X86WIN7, there will be garbled if the character value is> 127. If it is changed to the real character set, it will be correct and general. Below is my processing code:
first,chm to html to director:chm-html\

Code: Select all

Global n,m
Procedure ListFiles(directory.s,directoryid)
 If ExamineDirectory(directoryid,directory,"*.*")
  While NextDirectoryEntry(directoryid)
   file.s=DirectoryEntryName(directoryid)
   Select DirectoryEntryType(directoryid)
    Case #PB_DirectoryEntry_File
     this_extension.s=LCase(GetExtensionPart(file))
     If this_extension="html" Or this_extension="htm":file=directory+file:fz1=FileSize(file)
      If OpenFile(0,file,#PB_Ascii):r=1:ss.s="":While Eof(0) = 0
       v.a=ReadAsciiCharacter(0)
        If v>127:If r=1:r=2:m+1:Debug file:EndIf:n+1;''=127
         ss.s+"&#"+Str(v)+";":Else:ss.s+Chr(v):EndIf
        Wend:CloseFile(0):If r=2:CreateFile(0,file,#PB_Ascii):WriteString(0,ss):CloseFile(0):EndIf
    EndIf:EndIf
    Case #PB_DirectoryEntry_Directory
     If file<>"." And file<>"..":ListFiles(directory+file+"\",directoryid+1):EndIf
 EndSelect:Wend:EndIf
EndProcedure
dt=Date()
;TODO
directory.s="chm-html\"
temp.s=Right(directory,1)
If temp<>"\" And temp<>"/";/,\,/\,\/�ǵȼ۵�
directory+"\":EndIf
Debug "bug files:"
ListFiles(directory,0); the last parameter should be zero
Debug "bug files,Count="+Str(m)+"; bug,Count="+Str(n)
Debug "time use,minute:"+Str((Date()-dt)/60)

Re: hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Wed Apr 09, 2025 2:34 pm
by NicTheQuick
This is also related to this topic of mine: https://www.purebasic.fr/english/viewto ... 64#p636164

Re: hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Thu Apr 10, 2025 3:36 am
by gurj
PB's ASCII listing 256 characters, actually ASCII extension, should be called Eascii.

Re: hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Thu Apr 10, 2025 9:51 pm
by gurj
topic code,time is 2017,from my old file.
but
The original author of Listfiles () forgets who is. Sorry and thanks!

Re: hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Sat May 17, 2025 2:58 pm
by Andre
I think this is related to this one too: viewtopic.php?t=85124

Re: hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Sat May 17, 2025 5:27 pm
by gurj
remarks:
purebasic.chm,*.html use ansi[1250] to open is ok,but chr.html and asc.html use utf8 is ok.
========other:
in string/chr.html:
Chr(8364)=€=&#128;
Chr($BC)=1/4=&#188;
Chr(8364)=1/2=&#189;

in string/asc.html,i changed $2630 to $2640:
Chr($2640)=;cannot use &#*;
Chr($25BC)=;cannot use &#*;

Re: hope PB-chm:when Character>127 To "&#"+Str(Character)+";"

Posted: Tue Jun 10, 2025 8:36 pm
by Andre
Should be fixed with PB6.21 final, for which Fred changed all doc files to UTF8 and used a new DocMaker version for creating the 'PureBasic.chm' help file?