![]() ![]() Or maybe just adding something about that in the JUCE documentation. So, what I propose is the just the following : adding a function in the String class which returns a char, so anybody who manages ANSI coded data would be able to access to characters coded between -128 and -1 or 128 and 255, without using something I judge personnally not “JUCE spirit-compatible” like a static cast. I have to confess I am not at all familiar with the use of the cast instruction. I have been able to succeed because I have seen this thread. However, before I have found the solution to do the conversion from ANSI to Unicode / UTF8, I was looking for a “simple” solution in the JUCE classes, I mean a function of the String class I just have to call to get what I expect, and I did not find it. I understand that what I have tried to do is not used by everybody here And I don’t think JUCE is the cause of Visual Studio strange behaviour :mrgreen: Well, is it that wrong to think that one of the String function should return the content of the data with 8 bits instead of 7 ? I don’t think I am the only one who uses Strings for languages other than English with special characters, like French or Spanish ?Īnd my bad about the length of the original ASCII table And when the String is displayed correctly in JUCE, what is displayed by Visual Studio is wrong :lol: Well, some kind of… If the String contains “special french characters”, they are correctly displayed when they are coded as ANSI, and treated wrongly by JUCE (which considers them as UTF8). I would have liked a function which returns a char pointer, to get values between 0 and 255 or -128 / 127, whatever…Īnd one of the reasons why it annoyed me is because Visual Studio 2008 has the capability to show the content of the String classes in debug mode. So I had to use a cast to get what I needed. My problem was that the standard JUCE functions of the String class are unable to give something as simple as the ASCII value of the extended characters, because of the use of the juce_wchar : they give only values between 0 and 127. You do know that you can’t get a value beyond 127 with a signed char on a platform where sizeof(char) = 1 byte, right? So there’s no reason at all to bother caching the pointer that it returns.įirst, I have found a workaround, so I have code which allows me to do the conversion successfully I deliberately avoided giving the String class an operator const char*() because I think it’s best to always see “toUTF8()” in code that uses it, so that any reader will immediately be aware that a raw pointer is being taken, and that the encoding is UTF-8.Īnd it’s worth noting that toUTF8() is completely free - it just returns a pointer to the underlying string, so compilers will optimise it down to nothing. And it’s far less efficient than taking a copy of the String, which would simply involve a ref-count, not a malloc/copy.Īnd I wouldn’t wrap it in an object with an implicit cast to const char*, because this isn’t an operation that should be hidden from view. I wouldn’t use strcpy, because it’s just so 1990s. But the best way to keep a copy of that char* is to just keep the String object, and then call toUTF8() on it whenever you need the raw pointer. to prevent bugs and runtime errors due to invalid addresses.Sure, it’s possible to use strcpy or to build your own wrapper object. This function is used by the other, higher-level functions ![]() minimum and maximum allowed values, false otherwise. ![]() Returns true if the address is between the ![]() to protect eeprom cells outside this range. Absolute min and max eeprom addresses. Serial.printf("Station connected to the AP = %d\n", WiFi.softAPgetStationNum()) Serial.println(WiFi.softAP(ssid_1, pass2, 9) ? "Ready" : "Failed!") Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet)? "Ready" : "Failed!") Serial.print("configuring soft-AP configuration. String read_StringEE(int Addr, int length) It shows no error when I compile and burn it but it shows blank on serial monitor in the password section and it don't even set password. In the code I attached what I am trying to do is to save the "String password = "1234567890" to EEPROM and than reading it from EEPROM.And after reading it from EEPROM I am converting it into "const char* pass2". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |