delphi - Determinate if character is printable -



delphi - Determinate if character is printable -

i want develop hex-dump-view , have problems characters not printable in current active ansi codepage (cp_acp). how observe them , print dot instead?

my function looks this:

function hexchar(j: byte): ansichar; begin if j < $20 result := '.' // dirty workaround supports undefined characters of windows-1252 else if (getacp=1252) , ((j=$81) or (j=$8d) or (j=$8f) or (j=$90) or (j=$9d)) result := '.' else result := ansichar(j); end;

using delphi xe4 , font courier new, characters $81, $8d, $8f, $90, $9d invisible. getacp returns 1252, using windows-1252 . according wikipedia, range discovered not defined in windows-1252. how can check if character ordinal value j defined in current active codepage or not?

call getstringtypew function supports detailed character classification.

it's possible utilize getstringtypeex or deprecated getstringtypea functions, both calls getstringtypew according msdn. also, getstringtypeex hides difference between ansi , unicode versions , recommended msdn character type retrieval.

another possibility utilize tcharacter.getunicodecategory() method character.pas.

delphi winapi codepages

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -