Report Bugs Here

Moderator: Mmiscool

User avatar
By livetv
#55411 This "disappearing &nbsp;" bug shows up because the program contents are returned "as is" to the <textarea> tag on the editor page. The browser converts the &nbsp; to a space when it builds the contents of the textarea box. The way to solve this is to escape the ampersand, rendering the rest ("nbsp;") inert. In other words, just replace all "&" with "&amp;" What will happen is the &nbsp; is sent to the browser as &amp;nbsp; which populates in the box as &nbsp; (and we all go home happy).

Look in ESP8266Basic.ino at lines 978 and 986:

server->sendContent(TextboxProgramBeingEdited + CRLF);

I think changing it to this will solve the problem:

server->sendContent(TextboxProgramBeingEdited.replace(F("&"),F("&amp;")) + CRLF);

This is a quick and dirty fix. I suspect that we will see the same problem in the debugger so it might be a good idea to make a function out of this to be called by the editor and the debugger.

String escapeHTMLentities(String HTMLtext) { return HTMLtext.replace(F("&"),F("&amp;")) }

Either way....
Last edited by livetv on Tue Sep 20, 2016 1:43 am, edited 1 time in total.
User avatar
By aphawk
#55413 Thanks for the information.

Really there are some things to be fixed, like the impossibility of show more than one space inserted in text, that was I reported some days ago in this topic, and don't have any comment about this.

This is an very annoying bug because limits a lot messages in the displays AND in the Web browser !

There are some more bugs : I use the Portuguese language, and this means that I use many accent characters, like "é" , "ç" ,"ã" and many others.

Today I noted that this symbols can't be show by the web output commands, like WPRINT, and even when sent to an Oled display they appears as garbage text ....

In the documentation , at the finish there are one ASCII table, and I see many of these characters there.

I think that is very strange these characters are not show correctly.

But I have faith that Mmiscool will fix these things someday. The Web output don't cause serious problem, but the output to an Oled or one TFT display are making some projects be delayed.
User avatar
By livetv
#55416 The fix I noted earlier is for the &nbsp; bug and while it is nice to use text positioning, the answer to aphawk's other problem is resolved by using &nbsp;

Those missing 6 spaces? Browsers crush whitespaces into a single space. This is not a problem in ESPbasic. It's an normal but annoying characteristic of every browser.

Solution? Instead of:

wprint "Answer: 42 Question: ???"

You want to do this:

wprint "Answer: 42 &nbsp; &nbsp; &nbsp; Question: ???"

That WILL work until you try to re-edit your program. At the moment you just get an extra 3 spaces which leave you back where you started.

Workaround? For now, try this:

nbsp$ = "&" & "nbsp;"
spaces$ = " " & nbsp$ & " " & nbsp$ & " " & nbsp$ & " "
wprint "Answer: 42" & spaces$ & "Question: ???"


What about all those special characters? We should see what character set is being used when pages are returned to the browser.
User avatar
By aphawk
#55421 I will try this workaround. Thanks for your help !

And about the character set, the problem is the same in Browser AND in the Oled and TFT display output. I think that when sent to display, the character must be sent literally as is, without any Web treatment.

May be the case to implement a new command, something like LANGUAGE.SET="PT" , and review the display output code for Oled and Tft ?