Bug of Espruino IDE (not supporting UTF-8 comments) #6520
Replies: 1 comment
-
Posted at 2017-07-24 by @gfwilliams Which IDE are you using, and can you give me an example of what's not working? I just tried uploading:
And it works great for me. Posted at 2017-08-07 by MobiTech I am using Espruino Web IDE on Windows. The code that causes an error: If I remove this line the everything works well. Posted at 2017-08-07 by MobiTech
Posted at 2017-08-07 by Wilberforce Is it the ... - is that three . or a character... ? Posted at 2017-08-07 by MobiTech The error is caused by the word "für". If I write "fuer", everything works fine. Posted at 2017-08-08 by @gfwilliams I just tested this on Windows with the current Web IDE from the Chrome Web Store, and it works great for me. However, the 'Native' IDE (the one you install with an installer, that is needed for Bluetooth LE on Windows) does seem to have a problem. Could you let us know which one you're actually using? Posted at 2017-08-08 by @gfwilliams I just uploaded a new IDE: http://www.espruino.com/files/espruino_ide_win64_0v66.1.exe If you were using the Native IDE, if you install that IDE then I think your problems should be gone. Posted at 2017-08-08 by MobiTech I am using the native IDE Posted at 2017-08-08 by @gfwilliams Ok, then install the new IDE linked above and it should be fixed. Posted at 2017-08-08 by MobiTech You are right, it works well. Thanks. Posted at 2017-08-10 by MobiTech @gfwilliams I tried now an Inline-Comment in a function which is called inside OnInit. If I use a letter like ä,ö or ü, it throws an Syntax error. This seems to be a bug. Posted at 2017-08-11 by @gfwilliams Can you give me an example of the code and the exact error you get? I tried this initially, and it worked fine:
Posted at 2017-08-11 by MobiTech The function a() would be called inside onInit.
It is a part of a function which is called inside the onInit function. Posted at 2017-08-11 by @gfwilliams I just tried:
and it works fine. Please give me a FULL example with the problem, and the full error message. Posted at 2021-04-24 by user127815 Hi,
My other question is, is the operating temperature of the Espruino wifi CPU normal as shown in the attached picture, or does the motherboard require cooling? Thank you for your helping hand. Laci Attachments: Posted at 2021-04-24 by Robin Sat 2021.04.24 Hi @LACI So that we may better visualize what is going on, would you mind posting the Javascript code snippet that is performing the actual write back to the browser using the indicated var html. and, . . . please post the view source results that the browser is receiving so that we may compare with the image that is posted above. Posted at 2021-04-24 by Robin Sat 2021.04.24
Please post the code snippet that is used to retrieve that temperature reading. Under normal conditions, my Wifi does sometimes appear warm, but that reading seems way off. Are there any other devices in the circuit? Missing/mis-wired grounds? What voltage is being applied? Posted at 2021-04-24 by user127815 Hi Robin,
Chrome received html code
Posted at 2021-04-24 by user127815 I use sd card interface board with 3.3V and I2C SH 1106 oled display (also 3.3V). Posted at 2021-04-24 by Robin Sat 2021.04.24 From 1st snippet: I don't believe a WebSocket object returns a temperature in it's payload. Would you post the contents of L20 evt please. . . and/or link to datasheet/tutroial that demos that task. Is there an additional snippet with a function like getTemp()? p.116
Forgive me on: 'UTF-8 character encoding (hungarian's accented characters)' I concur with your observation for the '?' char and will have to defer to others for an answer. Your snippets will provide that detail needed for them to comment on. In the mean time: Does this assist at all?
Posted at 2021-04-24 by user127815 Temperature sending code
Posted at 2021-04-24 by Robin Okay, thanks that clears that up. re: 'E.getTemperature( )'
Also note: > http://www.espruino.com/Reference#l_E_getTemperature 'Note: This is not entirely accurate and varies by a few degrees from chip to chip. It measures the die temperature, so when connected to USB it could be reading 10 over degrees C above ambient temperature.' Posted at 2021-04-24 by user127815 Thanks for your help. I'm running another lap about the character encoding error. Posted at 2021-04-25 by @MaBecker this might help to display the chars correct in browser https://dev.w3.org/html5/html-author/charref three ways to code chars, pick your favorite one
Posted at 2021-04-25 by user127815 yes, that will be the solution. Posted at 2021-04-25 by @fanoush utf-8 can be broken on many layers, I just tried in WEbIDE with czech letters.
putting this to right side editor and uploading is better and produces this, also when typing cursor up it can be sen it is sent via \u unicode encoding
so now this looks like utf-8 encoded except last two letters ýá which are more common and not specific to czech, correct encoding is maybe prined here https://mothereff.in/utf-8#%C4%9B%C5%A1%C4%8D%C5%99%C3%BD%C3%A1 so most probably it is broken already when uploading the source code. however when now tried to upload this
so maybe 'correct' letters in that web page show because they are not utf-8 encoded and are actually also not shown as utf-8 Posted at 2021-04-25 by user127815 you maybe right. it occurred to me that perhaps the character encoding of the operating system could also cause this error. utf-8 character encoding seems good, but it is actually saved incorrectly in the source code. under windows, you can set the BOM in the text editor, which, if I know it, saves the block needed for utf-8/16 encoding in the given text file. this option i cant find for ubuntu gedit. https://www.w3.org/International/questions/qa-byte-order-mark Posted at 2021-04-25 by user127815 Do you know what is the maximum length of storable/runnable javascript code in Espruino wifi? Posted at 2021-04-25 by Robin Sun 2021.04.25
Use
Although it may be possible to use some fancy techinques to utilize flash in addition to available ROM, typically, Espruino needs as much memory as the code file size being uploaded, in order to unpack and reorganize in memory. Really rough approximation; take the number of free JsVars and divide by two to account for the need to reorganize during the upload process, then multiply by 16 bytes per JsVar. I don't have a WiFi handy, but if memory serves, an authentic Espruino Wifi provides around 2200 JsVars. 2200 / 2 * 16 = 17,600 chars rough approximation Posted at 2021-04-25 by @fanoush
Posted at 2021-04-26 by user127815 i just thought editor minimizing while downloading javascript code, so i can write my code beautifulized with tabulators and newlines. no needed to minimize manually to save flash memory. is it correct? Posted at 2021-04-26 by user127815 This solution seems to be better than javascript inline html code. i tried to save the html code to the sd card and read it back to a variable while initializing uc but i don't want my html firmware to be public. Posted at 2021-04-26 by @gfwilliams Hi! I'm surprised about the CPU temperature - is anything connected that might be causing a short? The Espruino WiFi does run quite hot when connected to WiFi, but normally I'd expect temperatures in the ~40 degrees C range. Above 50 is getting a bit high. The whole UTF-8 thing in Espruino is a bit of a pain. It stems from some code Amperka added to better handle encoding Russian characters, but I've had to tweak it a few times and honestly it just seems to make matters worse in most cases I have come across. As @MaBecker mentioned, encoding non-ASCII characters in HTML Posted at 2021-04-27 by Robin Mon 2021.04.26
I had this same question over four years ago and several provided responses to clear things up. Originally, I had mistaken an observation (noobie incorrect interpretation) for changes that had just occured with the new WebIDE ver ?? around Nov 2016 circa 1V88 Espruino, and was attempting to resolve. Just released (then) the WebIDE does a bit of housekeeping before upload along with additional cleanup once Espruino takes over. See @gfwilliams 's comments: 'and also strips out whitespace and comments between commands, which would have been ignored by Espruino anyway.' 'if something happens and data is re-arranged in memory then even that can effect the compression' A quick test would be to upload some heavily commented code both inside and outside functions, then upload. Use Another useful tool: Many helpful ideas on using Posted at 2021-04-27 by user127815 I don't know exactly how big my final code will be, but I solved the html processing (including the UTF-8 problem) by reading my html code directly from an sd card. Interestingly, the handling of the SH1106 oled (128x64) is handled very well by Espruino compared to e.g. the Raspberry Pi Pico micropython environment (but maybe I was the only one who was lame). Posted at 2021-04-27 by @MaBecker
http://forum.espruino.com/conversations/359042/#comment15855632 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-07-22 by MobiTech
Hi,
I would like to inform you that there seems to be a bug in the Espruino IDE. When I try to enter a comment with ä,ö,ü, the program will not be transfered to the device. I guess that the coding is not supported. It would be nice if we could use UTF-8 signs in the JavaScript comments.
Beta Was this translation helpful? Give feedback.
All reactions