- Home /
Detect and replace a wingding character with unicode character.
Hello, so I'm using itextsharp to import some text from a pdf. Inside the pdf are a bunch of bullets, but when i display them on TextMeshPro text or normal text, it looks like an empty square. (If this shows up: )
The bullets in the pdf are Wingdings Code 167, and I want to replace that code with \u2022 (Unicode bullet)
I'm using visual studio, so when I debug line per line, I can the bullets, but as soon as I encode the string to something else like unicode, the bullets get replaced with a "?" Here is the unencoded image. I want to replace those with the code \u2022 Here is the encoded image. I can't replace "?" with \u2022
Now I can't use the encoded text because I'm trying to replace the bullets with \u2022, but if they're questions marks it'll replace 'all' question marks, which would be wrong. So basically my main question is, how can I detect the Wingding bullets, their character code? From there it should be a simple matter of using string.replace("Wingding Code","\u2022")
Previously I was using:
byte[] UBytes = Encoding.Unicode.GetBytes(sentenceLines[i]);
if (UBytes[j] == 63)
{
char character = (char)UBytes[j];
sentenceLines[i] = sentenceLines[i].Replace(character.ToString(), "\u2022");
}
but yet again, I can't use encoding. I've tried ASCII, Unicode, UTF32, UTF8, UTF7, and BigEndianUnicode. All replace to a "?"
If you have any questions please ask.
Answer by JaredHD · Aug 08, 2017 at 08:19 PM
So I found my answer. I converted it to a byte without encoding it (Didn't know I could do that before) and tested if that byte occurred. Than if it occurred, I replaced it with /u2022.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
TextMesh is not rendering Font correctly 0 Answers
Create a 3d text using c# (font problem) 2 Answers
Bitmap text blurry and bad looking 1 Answer