I have an app where I display unicode symbols. Im using a dictionary which works well.
d.Value(&u00FC) = &u00FC
d.Value(&u06DE) = "&u06DE
I add the value and key in a listbox and this will show the unicode and the symbol
I want to use a sqlite db to contain both the unicode and symbol so I created a db and copied everything. The database works well with the copied data (as text data type) but my problem is being able to add new unicode and symbols.
I have a textfield to enter the unicode (example &u1F5DD)
Setting d.Value is the problem. If I set d.Value(Textfield.text) it wont convert to a symbol as it would if I entered d.Value(&u1F5DD).
How can I set d.value so it works the same as a dictionary. I believe d.Value must be something other than text to display the symbol properly.
Once the unicode and symbol is created in the dictionary I can copy it to the db and the symbol will show properly.
PS: Im a self taught hobby programmer.
Not sure what you are trying to achieve, but I use a module with constants like
With a string constant Snowman and its value being ??
The dictionary is hard coded in the app, so when I want to add a new item I have to open the app in XOJO ide to add the new item. What I want with a db is be able to add new unicodes from the running app.
Using a textfield to add unicode (example &u06DE added as d.Value(textfield1.text) will not
show in the db? as key, instead key is &u06DE.
writing “&u06DE” in a text field gives you the characters &, u, 0, 6, D, E (6 characters)
its NOT the same as the single unicode characters &u06DE
06De is JUST a number - but in unicode the number of a specific character (the number is its code point)
So you can do something like
// replace the &u with &h
dim codePointString as string = replaceall(textfield1.text, "&u", "&h")
// turn the code point string into the number
Dim codePoint As Integer = val(codePointString)
// now get the character for that code point
Dim actualChar As String = Encodings.UTF8.Chr( codePoint )
acnd actualChar will have the character for &u06DE if thats what you typed in
Btw note that not all fonts have implemented all code points!
Thank you, that solved my problem. I knew text would not work but I didn’t know how to get the correct code.