Fixed degree symbol translation
Added some debug code to look at data conversion during OLEdb read of dBase text.
This commit is contained in:
parent
c72ca9fb52
commit
36e4a5ee44
@ -163,6 +163,7 @@ namespace DataLoader
|
||||
s2 = s2.Replace("\x2191", @"\u8593?");
|
||||
s2 = s2.Replace("\x2193", @"\u8595?");
|
||||
s2 = s2.Replace("\x2207", @"\u8711?");
|
||||
s2 = s2.Replace("\x2591", @"\'b0"); // Degree Symbol
|
||||
|
||||
if (DoCaret) s2 = s2.Replace("^", @"\u916");
|
||||
//s2 = s2.Replace("^", @"\u916");
|
||||
@ -331,7 +332,7 @@ namespace DataLoader
|
||||
public static string ConvertText(string s1)
|
||||
{
|
||||
string s2 = s1;
|
||||
|
||||
//CompareBeforeAndAfter(s1);
|
||||
s2 = ReplaceUnicode(s2);
|
||||
// now replace underline on/off (AE,AF), super on/off (C6,C7)
|
||||
// bold on/off (D5, D6), subscript on/off (D1 A6), and
|
||||
@ -367,5 +368,56 @@ namespace DataLoader
|
||||
s2 = s2.Replace("\n", @"\par "); // line break in tables
|
||||
return s2;
|
||||
}
|
||||
|
||||
private static void CompareBeforeAndAfter(string txtBefore)
|
||||
{
|
||||
string txtAfter = ConvertSeq(txtBefore);
|
||||
if (txtAfter != txtBefore)
|
||||
{
|
||||
ListDifference(txtBefore, txtAfter);
|
||||
}
|
||||
}
|
||||
private static Dictionary<int, int> _SpecialChars = new Dictionary<int, int>();
|
||||
private static void ListDifference(string txtBefore, string txtAfter)
|
||||
{
|
||||
int nBefore = txtBefore.Length;
|
||||
int nAfter = txtAfter.Length;
|
||||
int n = nBefore > nAfter ? nAfter : nBefore;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int chrBefore = (int)(txtBefore[i]);
|
||||
int chrAfter = (int)(txtAfter[i]);
|
||||
if (chrBefore != chrAfter)
|
||||
{
|
||||
if (_SpecialChars.ContainsKey(chrBefore))
|
||||
_SpecialChars[chrBefore]++;
|
||||
else
|
||||
{
|
||||
_SpecialChars.Add(chrBefore, 1);
|
||||
Console.WriteLine("Character Difference 0x{0:X0000} 0x{1:X0000} @ {2}", chrBefore, chrAfter, i);
|
||||
//Console.WriteLine("Text Difference\r\nBefore '{0}'\r\nAfter '{0}'", txtBefore, txtAfter);
|
||||
string prefix = i == 0 ? "" : txtBefore.Substring(0, i - 1);
|
||||
string suffix = i == txtBefore.Length - 1 ? "" : txtBefore.Substring(i + 1);
|
||||
Console.WriteLine("Found in '{0}' 0x{1:X} '{2}'", prefix, chrBefore, suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nBefore != nAfter)
|
||||
{
|
||||
Console.WriteLine("Length Difference\r\nBefore '{0}'\r\nAfter '{0}'", txtBefore, txtAfter);
|
||||
}
|
||||
}
|
||||
public static void ListSpecialCharacters()
|
||||
{
|
||||
Console.WriteLine("Special Characters");
|
||||
foreach (int chr in _SpecialChars.Keys)
|
||||
{
|
||||
Console.WriteLine("0x{0:X0000} - {1} occurances", chr, _SpecialChars[chr]);
|
||||
}
|
||||
}
|
||||
public static void ResetSpecialCharacters()
|
||||
{
|
||||
_SpecialChars = new Dictionary<int, int>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -233,6 +233,7 @@ namespace DataLoader
|
||||
{
|
||||
try
|
||||
{
|
||||
//TextConvert.ResetSpecialCharacters();
|
||||
System.Diagnostics.Process[] wordProcesses = WordProcesses;
|
||||
MyFrmErrors.Clear();
|
||||
if (wordProcesses.Length > 0)
|
||||
@ -285,6 +286,7 @@ namespace DataLoader
|
||||
|
||||
}
|
||||
MessageBox.Show(string.Format("{0} seconds", ts.TotalSeconds));
|
||||
//TextConvert.ListSpecialCharacters();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Loading…
x
Reference in New Issue
Block a user