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@
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
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@
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+.
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@
Cheers, M@