I was trying to get the degree sign with Print and Wlog for Celcius, which works fine with :
Print "20.3";Chr$(176);"C" With Tera Term correct display degrees C and with Annex serial monitor ?C
If you also want to try this with Wlog, you will get an unstable WiFi connection and the serial connection will also be disrupted every time.
Reports like ws[/ws][29] error(1002): Invalid UTF-8 in text framexVLëý?? And the AP mode appears on my router because the firmware is rebooted.
Wlog "20.3";Chr$(176);"C" With Wlog correct display but communication problems serial and WiFi
And with a normal font eg P = Chr$(080) it goes well. And it also works fine if I copy the degree sign from a text file for C sign.
Also viewed the data of Wlog and Print with Annex serial and Tera Term.
For a = 0 to 255
Print a, Chr$()
Wlog a, Chr$()
Next a
End
Wlog Chr$() 0-255 Returns 0-31 # 32-126 ASCII 127-255 blank
Annex serial Chr$() 0-255 Returns 0-31 # 32-127 ASCII 128-255 ?
Tera Term Chr$() 0-255 Returns 0-31 empty 32-127 ASCII 128-255 ASCII
Is this a bug or a limitation and are you not allowed to use the Chr$() function string with Wlog or did I miss something?
Is there nothing about it in the manual?
And the Chr$() with only Print also occasionally gives communication problems , but not as bad as Wlog.
This probably also explains my comment a while back about the AP message in my router and the bad WiFi connection?
Jan
Print and Wlog and Chr$()
- cicciocb
- Site Admin
- Posts: 1964
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 422 times
- Been thanked: 1310 times
- Contact:
Re: Print and Wlog and Chr$()
HI,
no, this is not a bug but a "normal" behavior.
In fact all the exchanges with the "html" part (WLOG, HTML, CSS, ... commands) follow the UTF-8 format.
Only the first 127 characters are allowed and all the chars having an ascii code >127 must follow a special rule that enable the use of special character in practically any alphabet; these chars may be long from 2 to 4 characters UTF-8 charset.
This means that the "html chars" can be from 1 to 4 bytes and not only one byte as the ASCII.
In your particular case, the '°' character is C2 B0 in hex https://www.fileformat.info/info/unicod ... /index.htm
This is automatically handled "under the hood" by annex as, using these special characters, they are automatically included in the right sequence:
You should be able to find the solution in this snippet
This means that you can simply do
wlog "20.3°"
edit:
when the error appears, the websocket link between the module and the web page is lost but you can reconnect again with the button reconnect.
The module do not restart or reset and it continue to run the script (if a program is running)
no, this is not a bug but a "normal" behavior.
In fact all the exchanges with the "html" part (WLOG, HTML, CSS, ... commands) follow the UTF-8 format.
Only the first 127 characters are allowed and all the chars having an ascii code >127 must follow a special rule that enable the use of special character in practically any alphabet; these chars may be long from 2 to 4 characters UTF-8 charset.
This means that the "html chars" can be from 1 to 4 bytes and not only one byte as the ASCII.
In your particular case, the '°' character is C2 B0 in hex https://www.fileformat.info/info/unicod ... /index.htm
This is automatically handled "under the hood" by annex as, using these special characters, they are automatically included in the right sequence:
You should be able to find the solution in this snippet
Code: [Local Link Removed for Guests]
a$ = "°"
print len(a$)
print hex$(asc(mid$(a$,1,1)))
print hex$(asc(mid$(a$,2,1)))
wlog "20.3°"
edit:
when the error
Code: [Local Link Removed for Guests]
error(1002): Invalid UTF-8
The module do not restart or reset and it continue to run the script (if a program is running)