It is known that the range $80.$9F is not standard (I remember now). Will not return a Unicode character, because it is PeekA and not PeekB ! PeekB will indeed return a byte, and that byte will follow the compilation rule (unicode or ascii), but PeekA will only get the Ascii VALUE, and when issuing Chr() with that Ascii VALUE, we get the correct Ascii character.ĭid you try my last post with Unicode enabled? Then you should have seen that all characters were there, but with your code there are questions mark ($3F) between $80 and $9F, and that was exactly my initial problem. Please forgive me if I am wrong to say that you are wrong, but we are here to debate, so no offense If you wanted to do that you can simply use PokeS(*Mem + offset, -1, #PB_Ascii) and PeekS(*Mem + offset, -1, all respect, I think you are a little wrong here. The mode of the string functions is determined by the compiler settings that were selected.Īll this doesn't matter of course if you actually wanted the output of your function to produce a Unicode string of an 'ASCII translation' of a former Unicode string. PokeS() or PeekS(), you can only interpret it and operate on it in one way with the string functions, i.e. Even though you can store and 'interpret' memory in different ways with the memory functions, i.e. The end result is that you still end up with a Unicode string that contains 2-byte characters that represent an ASCII translation of the former Unicode string (phew!).Ĭonfusion of this sort arises from thinking that memory functions and string functions are operating the same way, they don't. This translates the results of your code as being: poking an ASCII version of a Unicode string into memory you constructing a Unicode string out of individual ASCII characters that you get from peeking into memory. However, it can only be stored and operated on in PureBasic strings (using PureBasic's string functions) in the format that is selected in the compile options. The string can be stored in memory in any format, even in UTF-8 format, using PureBasic's memory functions. This is because there is only one 'string format' being used in a program and that format is based on the compiler options (i.e. It will return a Unicode string and not an ASCII one. Code: Select all Result.s+Chr(PeekA(*Mem+i-1))
0 Comments
Leave a Reply. |