im writing a wpf application in blend 4 and im having trouble with special characters appearing as diamond question marks.
the text is coming from a resource dictionary at runtime.
Is there such a way that i can make the special characters such as é, è, ê and such.
my button eg
<Button Content="{DynamicResource 2190}"/>
my resource dictionary
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="2190">value</system:String>
value is the default. at the start of the program on creation of the window object, the resource is deleted and replaced with a new one from c# code:
if (File.Exists(filepath))
{
ResourceDictionary rd = new ResourceDictionary();
string line = "";
StreamReader file = new StreamReader(filepath);
while ((line = file.ReadLine()) != null)
{
string[] parts = line.Split(new char[]{','},2);
string key = parts[0];
string value = parts[1];
rd.Add(key,value);
// use it
}
file.Close();
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(rd);
}
when i click another button, a new language is loaded by calling the function using a different filepath.
i would prefer not having to go through the txt file and change all the special characters for their ASCii values.
is there any other way to dynamically display the characters after the dictionary is loaded? perhaps using regular expressions and find and replace on the resourcedictionary?