Re: transform "@S" in UTF8 BUG

204 views
Skip to first unread message

Hurricane

unread,
Aug 14, 2025, 11:39:56 AMAug 14
to Harbour Users, harbou...@googlegroups.com
Hi,
There's probably no bug, you just need to perform conversions correctly.
There's a cost to using CP/Char. It can be simple, confusing, complex or *dangerous.

* With careless use, corrupt index without realizing, without message. 


// Hurricane
REQUEST HB_CODEPAGE_UTF8EX

FUNCTION MAIN
   LOCAL cCP, cVal
   
   cVal:='śńć'
   for each cCP in { nil, 'UTF8EX' }
      ? '------------------------'
      hb_cdpselect(cCP)
      ? 'CP', hb_cdpselect()
      ? LEN(cVal)
      ? hb_utf8Len(cVal)
      ? transform(cVal,'@S3')
      ? transform(cVal,'@S6')
     
   NEXT
   RETURN NIL



Note:
I suggest using the Harbour Users group, it is easy to confuse incorrect use with bug.
The Harbour Developers group is constantly being used incorrectly: support, useless matters/polls, even to complain about Harbour, with an example of purposely wrong and meaningless syntax, syntaxes of other languages...

Regards,
Hurricane

Em quinta-feira, 14 de agosto de 2025 às 07:55:16 BRT, Marek Długosz <mdlug...@gmail.com> escreveu:


Hi!

I have found a bug in transform with "@Sxx" template 

hb_cdpselect('UTF8EX')
? transform('śńć','@S3') -> ś♣   

Regards

Marek

Hurricane

unread,
Aug 15, 2025, 3:22:11 PMAug 15
to harbou...@googlegroups.com
You left it on record, maybe someone will review it someday.

You can move forward with a simple alternative:
cVal:='śńć'
? PADR( cVal, 3 ) // UTF8EX compatible

If it was with  @...GET/@S...  I know it works

Regards,
Hurricane

Em sexta-feira, 15 de agosto de 2025 às 10:30:26 BRT, Marek Długosz <mdlug...@gmail.com> escreveu:


It should behave exactly the same

? transform('śńć','@S3') -> ś♣   
? transform('śńć','XXX') -> 'śńć'

Marek

Hurricane

unread,
Aug 17, 2025, 2:47:10 PMAug 17
to 'Hurricane' via Harbour Users
fixed:

2025-08-17 18:27 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
  * contrib/gtqtc/gtqtc.h
  * contrib/gtqtc/gtqtc1.cpp
    + added support for disabling title and frames of console window by
         hb_gtInfo( HB_GTI_WINTITLE, <lNoFrame> )

  * src/rtl/transfrm.c
    ! fixed bug in "@S<n>" transformation when multibyte CDP is used


Reply all
Reply to author
Forward
0 new messages