I have a global string constant of name “kPrm0L” that isn’t being recognized.
Is this something peculiar to Windows?
It is recognized in
If 0 < Instr(strg, kPrm0L) Then //do something
Do I have to use a computed property because of Windows?
Is encoding an issue?
What does strg contain?
Thanks. Encoding is an issue since the text is utf8. I’m not sure how to qualify a constant
I decided to use a computed property with
Return &u3c + &u70 + &u30 + &u3e
was that the issue?
Sorry, Was using Mac to figure it out and hadn’t gotten to PC.
That didn’t work.
I tried that since code wise it was easier than trying to get a string set to a particular encoding.
I checked and the textarea that is utf8. Not sure which to do
What exactly is “not working”
by default string encoding is UTF-8
Constant Name : kPrmOL
Default Value : <p1>
Type : String
Scope : PUBLIC
if your error is “This item does not exist”
then check that the SCOPE IS PUBLIC, and the you defined it in a MODULE, not a WINDOW
Are your parameters reversed? From the LR:
result = InStr([start,] source, find)
Are you searching the constant for a string, or a string for the constant? Posting your code will help.
I hadn’t considered explaining that. It exists.
It is not being recognized on Windows in the string comparison of Instr. I’d put the exact lines and text here but I am on my phone.
It works quite well on a Mac. I have a complement kPrm0R and
I have the two constant strings shrunk to a textsize value of one and the section in between made bold. When I had the constants as a single character it worked on both platforms
Im sorry to have to ask:
What does that last post actually mean?
Are you trying to see if strg contains ?
just try it simply first
If instr(strg,"<p1>") > 0 then
There is nothing special about that requires encoding.
[quote]I have a complement kPrm0R
What does that mean?
Are you using a translator program to turn something into English?
What does that mean?
is 4 characters… what are you doing?
First off, the previous character that I used as a property/computed property are known as “harpoons” or “?” and “?”. I called this Prime1L and Prime1R. They worked.
I replaced that with html styled notation a while ago.
Here is a copy of a line of text that I read in.
The following is the first line that my html styled “Prime” or Prm0L and Prm0R separators does not work on a PC.
If 0 < InStr(tCont.Text, Prm0L) And 0 <> InStr(tCont.Text, Prm0R) Then//Getting Prime locations
tCont is the control and in this case a textarea. tCont.Text is the control’s text.
I haven’t worked on making the code work on displaying the textarea with the fontsize and other attributes like bold and underline and getting the correct length to make the Prime sections ( and ) disappear.
There are 3 images that follow.
- Correct view of string on a Mac.
- Showing another way I know I have Instr correct.
This first image is showing the Mac with bolding and underlining.
The next image is another way I know my Instr coding works because the textarea also has 2 areas with different font size.
The third image is what happens on a PC and you will see no bolding or underlining.
well that provides a ton more information…
I don’t think the issue is with your “constant”… but with the encoding of the string you are searching
Thanks for the confidence.
I agree and am confused because everywhere I check it is UTF8.
I look at my “constants” and the string in the textarea and other places in the little debugging box that shows the actual text and it’s all UTF8.
I have had problems with encoding and debugged those and they work correctly.
dim s as string="a <p0>song</p0>; [??] a melody; an air; a tune; an aria¶??? an arietta.¶?? ??? a song composer.¶??? a collection of songs.¶?? ?? the song form"
the encoding of S is NIL… (on macOS at least)
so perhaps what you THINK is UTF-8 isn’t really
I just double checked at the usual culprits and found no problems.
I put a BOM on every file and it is saved encoded as matching the BOM.
Every File I read in goes through the same inspection and I would get an error message if it shows up wrong. They do occasionally get screwed like if I forget and think I can save it with something like MS Word. TextWrangler works always.
This is the code that reads it in. I’m not going to translate properties.
Dim aFile As String = rCardtis.ReadAll
Dim aBOM as String = Encdng.Chr(&hFEFF)//Binary is EFBB BF
Dim bomLength As Integer = aBOM.LenB
If aFile = ""Then
MsgBox “The File has been damaged. Please use the Backup.”
ElseIf Encdng.IsValidData(AFile) And left(AFile,1) = Encdng.Chr(&hFEFF) Then
aFile = DefineEncoding(AFile.MidB(bomLength + 1), Encdng)
ElseIf Encdng.IsValidData(aFile) = False And left(aFile,1) = Encdng.Chr(&hFEFF) then
aFile = Mid(aFile, 2)
//aFile = ConvertEncoding(aFile, Encdng)
MsgBox "The “+ typ + " File has been Converted to UTF8, And the BOM Is Correct. It Might Be Damaged.”
Left(aFile,1) = Encdng.Chr(&hFEFF) will fail unless the encoding of aFile is set first. I think that’s your logic error.
I set the property Encdng as TextEncoding like this
Encdng = Encodings.UTF8
I set the inputstream rCartis to UTF8.
If there is something more, I’d like to know.
Well, then that should work. And fwiw, it appears to work here. It correctly identifies the BOM and I get a value of 3 for and a value of 11 for .
Thanks to both Tim. Back to “harpoons” or “?” and “?”.
Could the type Text be different from in this case?
I have been reading pieces about it. I have the XDEV Mag set. Do you know good articles?
I could then eventually try internet styled markup again.