Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

SRP_Rotate_Array() truncates in UTF8 mode

It appears that data gets truncated when trying to rotate an array that contains multi-byte characters in UTF8 mode. This is with 32bit SRPutilities versions 1.6 and 2.1.2 in OI 9.4.4.

Eg
With SRP Utilities v1.6,:
srp_rotate_array( 'Wang Weiyu': @vm: '王韦予')
returns 'Wang Weiyu': @fm: '王韦' (missing '予')

srp_rotate_array( '王韦予': @vm: 'Wang Weiyu')
returns '王韦予': @fm: 'Wang Weiy' (missing 'u')


With SRP Utilities v2.1.2 (or 2.1.1), it's worse!:
srp_rotate_array( 'Wang Weiyu': @vm: '王韦予')
returns 'Wang Weiyu': @fm: '王' (missing '韦予')

srp_rotate_array( '王韦予': @vm: 'Wang Weiyu')
returns '王韦予': @fm: 'Wang' (missing ' Weiyu')


The SRP_Array( 'Rotate') function has the same effect.

It seems very closely related to this issue with string byte length.

Cheers, M@

Comments

  • Thanks Kevin!

    Although if I run that as an RDKinstall and test the line, I get an "SRP_ROTATE_ARRAY, line 40: SRPRotateArray does not exist in dynamic link library SRPUTILITIES" error. I even tried copying over the SRPutilities.dll manually.

    Cheers, M@
  • Here's a direct link to the DLL. Maybe the DLL got corrupted when building the installer.

    If that doesn't work, you can use the 2.1.2 DLL for now. The DLL actually didn't change at all. I simply recompiled it with a matching version number. The fix was pure BASIC+.
  • Thanks. That dll is the same as in the zip file, but neither of them work. The 2.1.2 dll does work though. The 2.1.2 dll is 1.2Mb whereas the 2.1.3 dll is 1.43Mb.

    So Rotate looks ok - thanks.
    I've looked at the other array functions as well:

    It seems that Join has a similar issue. Eg
    a='王韦予': @vm: 'Wang Weiyu'; @ans=srp_array( 'join', a, a)
    returns '王韦予': @fm: 'Wang' (missing ' Weiyu')

    And also Reorder:a='' for i = 1 to 7 a<-1> = '王韦予': i next i ans = srp_reorder_array( a, 3) returns a partial array王韦予3 王韦予1 王韦予2 ç

    Sort seems ok though.
    Clean was fixed previously.

    ( I'm guessing these are easy fixes ;)
    Cheers, M@
  • Good catch. These errors are due to using Len() instead of getByteSize() when in UTF8 mode. 2.1.4 fixes this.
  • :) I suspected that ;). All good now - thanks for this.

    Cheers, M@
Sign In or Register to comment.