----------------------------------------------------------------------
--- Knud van Eeden --- 05 September 2008 - 03:16 pm ------------------

Language: Computer: BASIC: BBCBASIC: Windows: Unicode: Character: Byte: Operation: View: How to: Russian

===

Steps: Overview:

 1. -Get your Russian text

     1. -E.g.

          Copy it from a Russian text Internet web page

 2. -Paste it in Notepad

 3. -Save it as 'Unicode' type

     1. -E.g.

          ddd.txt

 4. -Open that file in BBCBASIC

 5. -Print it byte after byte

 6. -E.g. create the following program:

--- cut here: begin --------------------------------------------------
xScreenI% = 500 yScreenI% = 10 : *FONT Arial Unicode MS, 16 : fileName$ = "ddd.txt" : fileP% = OPENIN( fileName$ ) : byteI% = BGET#( fileP% ) : PRINT; byteI% : IF ( NOT ( byteI% = 255 ) ) THEN PRINT fileName$ + " " + "is not a Unicode file, it should start with byte 255" ENDIF : byteI% = BGET#( fileP% ) : PRINT; byteI% : IF ( NOT ( byteI% = 254 ) ) THEN PRINT fileName$ + " " + "is not a Unicode file, it should be byte 254" ENDIF : PRINT "------------------------------------" : WHILE NOT EOF# fileP% : byte1I% = BGET#( fileP% ) byte2I% = BGET#( fileP% ) : PRINT "Unicode character:" PRINT "byte1 (decimal) = "; byte1I% PRINT "byte2 (decimal) = "; byte2I% PRINT PRINT "byte1 (hexadecimal) = "; STR$~( byte1I% ) PRINT "byte2 (hexadecimal) = "; STR$~( byte2I% ) PRINT PRINT "location:" PRINT PRINT "row = "; " "; ( byte1I% DIV 16 ) PRINT "column = "; " "; ( byte1I% MOD 16 ) PRINT "page = "; " "; ( byte2I% ) PRINT "------------------------------------" : PROCUnicode( byte1I%, byte2I%, xScreenI%, yScreenI% ) : REPEAT UNTIL GET : ENDWHILE : END : : : DEF PROCUnicode( byte1I%, byte2I%, xScreenI%, yScreenI% ) LOCAL uniCode$ uniCode$ = CHR$( byte1I% ) + CHR$( byte2I% ) SYS "TextOutW", @memhdc%, xScreenI%, yScreenI%, uniCode$, LEN( uniCode$ ) / 2 SYS "InvalidateRect", @hwnd%, 0, 0 ENDPROC :
--- cut here: end ---------------------------------------------------- 7. -That will show a screen output similar to the following: --- cut here: begin --------------------------------------------------
255 254 M <- Russian character representation ---------------------------- 255 254 ------------------------------------ Unicode character: byte1 (decimal) = 60 byte2 (decimal) = 4 byte1 (hexadecimal) = 3C byte2 (hexadecimal) = 4 location: row = 3 column = 12 page = 4 ------------------------------------ ----------------------------
--- cut here: end ---------------------------------------------------- === Book: see also: === Diagram: see also: === File: see also: === File: version: control: see also: === Help: see also: === Image: see also: === Internet: see also: --- BBCBASIC for Windows: Unicode: Link: Can you give an overview of links? http://goo.gl/JcUGx === Podcast: see also: === Record: see also: === Screencast: see also: === Table: see also: === Video: see also: === <version>1.0.0.0.1</version> ----------------------------------------------------------------------

Share |

This web page is created and maintained using the Semware TSE text editor