MAPUNICODE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
* The [[LONG]] {{Parameter|unicode&}} value is a [[HEX$|hexadecimal]] or decimal code value from a [[Unicode]] [[Code Pages|Code Page]].
* The [[LONG]] {{Parameter|unicode&}} value is a [[HEX$|hexadecimal]] or decimal code value from a [[Unicode]] [[Code Pages|Code Page]].
* The {{Parameter|asciiCode%}} [[INTEGER]] parameter is any [[ASCII]] or Extended code value from 0 to 255.
* The {{Parameter|asciiCode%}} [[INTEGER]] parameter is any [[ASCII]] or Extended code value from 0 to 255.
* Use the Unicode Page Table values listed here: [http://en.wikipedia.org/wiki/Category:DOS_code_pages DOS Code Pages] or [http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/ Windows Mapping]
* Use the Unicode Page Table values listed here: [[Wikipedia:Category:DOS code pages|DOS Code Pages]] or [http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/ Windows Mapping]
* Once the codes are mapped, key entries will display the unicode character in the '''monospace ''' [[_FONT|font]] selected.
* Once the codes are mapped, key entries will display the unicode character in the '''monospace ''' [[_FONT|font]] selected.
* The [[_MAPUNICODE (function)|_MAPUNICODE]] function can be used to verify or read the present [[Unicode]] UTF32 code point settings.
* The [[_MAPUNICODE (function)|_MAPUNICODE]] function can be used to verify or read the present [[Unicode]] UTF32 code point settings.
Line 49: Line 49:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [https://qb64phoenix.com/forum/showthread.php?tid=1169 Featured in our "Keyword of the Day" series]
* [[_MAPUNICODE (function)]]
* [[_MAPUNICODE (function)]]
* [[ASCII]], [[Unicode]], [[_FONT]]
* [[ASCII]], [[Unicode]], [[_FONT]]
* [[_KEYHIT]], [[_KEYDOWN]]
* [[_KEYHIT]], [[_KEYDOWN]]
* [[ASC]], [[INKEY$]], [[CHR$]]
* [[ASC]], [[INKEY$]], [[CHR$]]
* [[Code Pages]] {{text|(by region)}}
* [[Code Pages]]
* [[Text Using Graphics]]
* [[Text Using Graphics]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 16:31, 14 June 2024

The _MAPUNICODE statement maps a Unicode value to an ASCII character code value.


Syntax

_MAPUNICODE unicode& TO asciiCode%


  • The LONG unicode& value is a hexadecimal or decimal code value from a Unicode Code Page.
  • The asciiCode% INTEGER parameter is any ASCII or Extended code value from 0 to 255.
  • Use the Unicode Page Table values listed here: DOS Code Pages or Windows Mapping
  • Once the codes are mapped, key entries will display the unicode character in the monospace font selected.
  • The _MAPUNICODE function can be used to verify or read the present Unicode UTF32 code point settings.
  • _MAPUNICODE can place the Unicode characters TO any ASCII code space you desire (0 to 255).


Examples

Example: Converting the extended ASCII characters to other characters using DATA from the Unicode Code Pages.

SCREEN 0
_FONT _LOADFONT("C:\windows\fonts\cour.ttf", 20, "MONOSPACE")

RESTORE Microsoft_pc_cpMIK
FOR ASCIIcode = 128 TO 255
  READ unicode
  _MAPUNICODE Unicode TO ASCIIcode
NEXT


FOR i = 128 TO 255
  PRINT CHR$(i) + " ";
  cnt = cnt + 1
  IF cnt MOD 16 = 0 THEN PRINT
NEXT
END

Microsoft_pc_cpMIK:
DATA 1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055
DATA 1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071
DATA 1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087
DATA 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103
DATA 9492,9524,9516,9500,9472,9532,9571,9553,9562,9566,9577,9574,9568,9552,9580,9488
DATA 9617,9618,9619,9474,9508,8470,167,9559,9565,9496,9484,9608,9604,9612,9616,9600
DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
Note: The Unicode data field is created by adding DATA before each line listed for the appropriate Code Page.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link