1 страниц (5 вхождений)
String Encoding - Is it possible to enforce a single method of string encoding or convert between encoding standards - Сообщения
#1 Опубликовано: 15.08.2023 00:18:03
It appears that SMath can have text (strings) encoded using different standards in the same worksheet, or possibly it is just ambivalent to encoding standards (which makes sense).
This leads to the problem described by Martin in this post:
https://en.smath.com/forum/yaf_postst21885_String-compare-problem-with-different-encoding-schemes.aspx
My question:
In order to guarantee text strings can be compared, is it possible to either:
1 - Convert one text encoding scheme to another, so that both strings could be converted to the same scheme before being compared
2 - Have some other workaround for this problem
Thanks,
Peter
This leads to the problem described by Martin in this post:
https://en.smath.com/forum/yaf_postst21885_String-compare-problem-with-different-encoding-schemes.aspx
My question:
In order to guarantee text strings can be compared, is it possible to either:
1 - Convert one text encoding scheme to another, so that both strings could be converted to the same scheme before being compared
2 - Have some other workaround for this problem
Thanks,
Peter
#2 Опубликовано: 15.08.2023 00:31:40
I have made two more discoveries since posting this:
Firstly, if I have two strings using different encoding schemes:
myString1:="myString"
myString2:="myString"
such that:
myString1 = myString2 = 0
then
substr(myString1,1) = substr(myString2,1) = 1
I assume that taking a sub-string of a string changes the encoding system (although I'm not sure why that would be the case). Is this correct? Is this a robust workaround, or might this not always be the case.
Secondly,
If you open and close the file then myString1 = myString2 = 1
I assume that closing and re-opening the file changes the encoding system (which make more sense), but is not a practicable work around.
Firstly, if I have two strings using different encoding schemes:
myString1:="myString"
myString2:="myString"
such that:
myString1 = myString2 = 0
then
substr(myString1,1) = substr(myString2,1) = 1
I assume that taking a sub-string of a string changes the encoding system (although I'm not sure why that would be the case). Is this correct? Is this a robust workaround, or might this not always be the case.
Secondly,
If you open and close the file then myString1 = myString2 = 1
I assume that closing and re-opening the file changes the encoding system (which make more sense), but is not a practicable work around.
2 пользователям понравился этот пост
#3 Опубликовано: 15.08.2023 13:07:12
Greetings,
From a Plugin Standpoint, the encoding/decoding can be handelded through SMath.Manager.TermsConverter:
From a native solution, you can try using some of the other string functions (e.g., strtolower(), strtoupper()) to convert a string to the same scheme:
I think your best option would be to use the substr() function, just call your strings and return the 'full' string as a substring (i.e., your starting index = 1), the result should be of the same text scheme:
May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
From a Plugin Standpoint, the encoding/decoding can be handelded through SMath.Manager.TermsConverter:
SMath.Manager.TermsConverter.EncodeText("text"
SMath.Manager.TermsConverter.DecodeText("text"
From a native solution, you can try using some of the other string functions (e.g., strtolower(), strtoupper()) to convert a string to the same scheme:
a:"mydString"="mydString"
b:"my\0064\String"="my\0064\String"
a≡b=0
a:strtolower("mydString"
="mydstring"
b:strtolower("my\0064\String"
="mydstring"
a≡b=1
a
substr("mydString",1))="mydString"
b
substr("my\0064\String",1))="mydString"
a≡b=1
May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
1 пользователям понравился этот пост
Oscar Campo 15.08.2023 13:14:00
#4 Опубликовано: 15.08.2023 14:32:31
WroteI have made two more discoveries since posting this:
Firstly, if I have two strings using different encoding schemes:
myString1:="myString"
myString2:="myString"
such that:
myString1 = myString2 = 0
then
substr(myString1,1) = substr(myString2,1) = 1
I assume that taking a sub-string of a string changes the encoding system (although I'm not sure why that would be the case). Is this correct? Is this a robust workaround, or might this not always be the case.
The substring workaround worked well for my Maxima test suite. No more inequality indication for visually identical strings. Thanks a lot!
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Опубликовано: 15.08.2023 15:27:26
My understanding is that you want multiple Bolean
so to carry some intelligible project.
8 years old native string system.
Project GROCERY.sm (9 КиБ) скачан 24 раз(а).
so to carry some intelligible project.
8 years old native string system.
Project GROCERY.sm (9 КиБ) скачан 24 раз(а).
1 страниц (5 вхождений)
-
Новые сообщения
-
Нет новых сообщений