Files
harbour-core/harbour/tests/utf8at.prg
Viktor Szakats 90ef3520b2 2012-10-02 01:10 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbmisc/hbedit.prg
  * src/debug/dbghelp.prg
  * src/debug/dbgtmenu.prg
  * src/debug/dbgtwin.prg
  * src/debug/dbgwa.prg
  * src/rtl/browse.prg
  * src/rtl/listbox.prg
  * src/rtl/radiogrp.prg
  * src/rtl/tmenuitm.prg
  * src/rtl/tpopup.prg
  * tests/gtwin.prg
  * tests/box.prg
  * tests/boxtst2.prg
  * tests/scroll.prg
  * tests/vidtest.prg
    ! fixed to use new unicode-compatible box.ch/button.ch macros
      For standalone programs (in tests) in only makes any difference
      when running them as scripts, now they will work (after
      adding hbshell_gtInteracive() call at startup), while
      before the drawing chars were scrambled.

  * src/rtl/browse.prg
  * src/rtl/checkbox.prg
  * src/rtl/dbedit.prg
  * src/rtl/dbedit.prg
  * src/rtl/listbox.prg
  * src/rtl/scrollbr.prg
  * src/rtl/tmenuitm.prg
    ! fixed Chr() calls for drawing chars to unicode strings
      to be compatible with both unicode and non-unicode (and
      any BOXCP) mode.

  * src/rtl/browse.prg
    ! fixed to use '!( hb_keyChar( nKey ) == "" )' instead
      of looking for keycode between 32 and 255 (inclusive)
      making it unicode compatible
    * formatting

  * src/rtl/tpersist.prg
  * src/rtl/memoedit.prg
  * src/debug/debugger.prg
  * src/debug/dbgthsh.prg
  * src/debug/dbgtarr.prg
  * src/debug/tbrwtext.prg
    * formatting

  * src/rtl/tmenuitm.prg
  * src/rtl/tpopup.prg
    + added TOFIXes where drawing chars are used as internal
      flags. This may cause problems if switching CPs while
      using these objects.

  * tests/sbartest.prg
    + unicode compatibility while keeping it Cl*pper compatible
    ! fixed RTE due to using wrong SCROLLBAR method

  * tests/tb1.prg
    * changed to use new unicode-compatible box.ch/button.ch macros
      while keeping Cl*pper compatibility

  * tests/vidtest.prg
    ! fixed remaining drawing chars using Chr() (Cl*pper
      compatibility maintained)

  * tests/testsha2.prg
  * tests/utf8at.prg
    ! fixed to use HB_BCHAR() instead of CHR() for unicode compatibility.

  ; NOTE: After above changes scripts and commands run via hbrun 
          will display drawing chars properly. Unicode apps as 
          well, even with BOXCP set to unicode, too.

  ; TODO: Fix above things also on C level, f.e. DISPBOX() with
          numeric box drawing request.
2012-10-01 23:16:18 +00:00

52 lines
2.3 KiB
Plaintext

/*
* $Id$
*/
/* hb_utf8at() / hb_utf8rat() test
UTF8-aware hb_at()/hb_rat() */
#include "simpleio.ch"
REQUEST HB_CODEPAGE_FR850
REQUEST HB_CODEPAGE_FRISO
PROCEDURE Main()
#define _UTF8_E_ACUTE hb_BChar( 0xC3 ) + hb_BChar( 0xA9 )
#define _UTF8_E_CIRCUMFLEX hb_BChar( 0xC3 ) + hb_BChar( 0xAA )
LOCAL u := "Une r" + _UTF8_E_CIRCUMFLEX + "ve est la moiti" + _UTF8_E_ACUTE + " d'une r" + _UTF8_E_ACUTE + "alit" + _UTF8_E_ACUTE + "."
LOCAL i := hb_translate( u, "UTF8", "FRISO" )
LOCAL d := hb_translate( u, "UTF8", "FR850" )
LOCAL uu := _UTF8_E_ACUTE
LOCAL ii := hb_translate( uu, "UTF8", "FRISO" )
LOCAL dd := hb_translate( uu, "UTF8", "FR850" )
LOCAL l := Len( uu ) + 2
? "ISO-8859-1 -", PadR( ii, l ), "=>", i
?
? "CP850 -", PadR( dd, l ), "=>", d
?
? "UTF-8 -", PadR( uu, l ), "=>", u
?
? at( ii, i ), rat( ii, i ), "- ISO-8859-1 at/rat"
? hb_at( ii, i ), hb_rat( ii, i ), "- ISO-8859-1 hb_at/rat"
? hb_utf8at( ii, i ), hb_utf8rat( ii, i ), "- ISO-8859-1 hb_utf8at/rat"
? at( dd, d ), rat( dd, d ), "- CP850 at/rat"
? hb_at( dd, d ), hb_rat( dd, d ), "- CP850 hb_at/rat"
? hb_utf8at( dd, d ), hb_utf8rat( dd, d ), "- CP850 hb_utf8at/rat"
? at( uu, u ), rat( uu, u ), "- UTF-8 at/rat"
? hb_at( uu, u ), hb_rat( uu, u ), "- UTF-8 hb_at/rat"
? hb_utf8at( uu, u ), hb_utf8rat( uu, u ), "- UTF-8 hb_utf8at/rat"
?
? hb_at( ii, i, 33 ), hb_rat( ii, i, 33 ), hb_at( ii, i, , 33 ), hb_rat( ii, i, , 33 ), "- ISO-8859-1 hb_at/rat"
? hb_utf8at( ii, i, 33 ), hb_utf8rat( ii, i, 33 ), hb_utf8at( ii, i, , 33 ), hb_utf8rat( ii, i, , 33 ), "- ISO-8859-1 hb_utf8at/rat"
? hb_at( dd, d, 33 ), hb_rat( dd, d, 33 ), hb_at( dd, d, , 33 ), hb_rat( dd, d, , 33 ), "- CP850 hb_at/rat"
? hb_utf8at( dd, d, 33 ), hb_utf8rat( dd, d, 33 ), hb_utf8at( dd, d, , 33 ), hb_utf8rat( dd, d, , 33 ), "- CP850 hb_utf8at/rat"
? hb_at( uu, u, 33 ), hb_rat( uu, u, 33 ), hb_at( uu, u, , 33 ), hb_rat( uu, u, , 33 ), "- UTF-8 hb_at/rat"
? hb_utf8at( uu, u, 33 ), hb_utf8rat( uu, u, 33 ), hb_utf8at( uu, u, , 33 ), hb_utf8rat( uu, u, , 33 ), "- UTF-8 hb_utf8at/rat"
RETURN