Percentage character not read from txt file

If doesn't fit into any other category ....
Post Reply
Zim
Posts: 291
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 267 times
Been thanked: 131 times

Percentage character not read from txt file

Post by Zim »

Hi Gents
I have a text file that has a % symbol in it, but wlog and file.read can't see it. Is there a way around this?

Thanks
Zim
User avatar
cicciocb
Site Admin
Posts: 2093
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 449 times
Been thanked: 1385 times
Contact:

Re: Percentage character not read from txt file

Post by cicciocb »

What is the exact content of the file?

The % has a special meaning in html so this could be the problem
Zim
Posts: 291
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 267 times
Been thanked: 131 times

Re: Percentage character not read from txt file

Post by Zim »

Thanks for the quick responce!

try$ = file.read$("/data.txt",9,6)
wlog try$

or


wlog file.read$("/data.txt",9,6)



data.txt
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2093
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 449 times
Been thanked: 1385 times
Contact:

Re: Percentage character not read from txt file

Post by cicciocb »

Try to remove the 9,6 and see
Zim
Posts: 291
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 267 times
Been thanked: 131 times

Re: Percentage character not read from txt file

Post by Zim »

percentage and spaces don't show up.
User avatar
cicciocb
Site Admin
Posts: 2093
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 449 times
Been thanked: 1385 times
Contact:

Re: Percentage character not read from txt file

Post by cicciocb »

Use the debug window to see the content of the variable or use print
Zim
Posts: 291
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 267 times
Been thanked: 131 times

Re: Percentage character not read from txt file

Post by Zim »

print file.read$("/date.txt") --> 12345678999full (should read 123456789 99% full)

no errors in serial window

print "12 3%" --> 12 3% ( print function does show spaces and %)
User avatar
cicciocb
Site Admin
Posts: 2093
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 449 times
Been thanked: 1385 times
Contact:

Re: Percentage character not read from txt file

Post by cicciocb »

Are you using the ESP8266?

I cannot reproduce the problem on the ESP32, i've just tried with Wokwi and WLOG "%" works
image.png
You do not have the required permissions to view the files attached to this post.
Zim
Posts: 291
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 267 times
Been thanked: 131 times

Re: Percentage character not read from txt file

Post by Zim »

cicciocb

I cold booted the module (esp8266 v1.48) and the PC. Now it works as it should. errrrrrrr!

Please accept my donation for wasting your time...

Thanks
Zim
User avatar
cicciocb
Site Admin
Posts: 2093
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 449 times
Been thanked: 1385 times
Contact:

Re: Percentage character not read from txt file

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Wed Dec 06, 2023 5:41 pm cicciocb

I cold booted the module (esp8266 v1.48) and the PC. Now it works as it should. errrrrrrr!

Please accept my donation for wasting your time...

Thanks
Zim
:D
Thanks Zim,
it was a pleasure for me :mrgreen:
Post Reply