Dean Forant

Dean Forant

  • NA
  • 1
  • 0

Alt codes 147 & 148 and using them with Japanese Locale

Jan 5 2011 8:49 AM

Hi all,
I working on a interesting problem. We have some software that displays english byte values 147 and 148 for opening and closing quotes respectivly. These quotes are used as part of a parsing routine for use in a second application.
What I'm finding is the quotes will display fine with english but when the locale is changed to Japanese I get dots in place of the quotes.
The thing is I can go to various programs (i.e Word, NotePad, IE) and enter the alt codes for 147 and 148 and get the english quotes fine with the japanese locale. The only place that doesn't seem to render it is in .NET. below is the code sample that im using to display the quotes.
public static class SpecialText
    {
        public static string SmartQuoteLeft
        {
            get { return System.Text.Encoding.Default.GetString(new byte[] { 147 }); }
        }
        public static string SmartQuoteRight
        {
            get { return System.Text.Encoding.Default.GetString(new byte[] { 148 }); }
        }
        internal static string AddBeginningSmartQuotes(string content)
        {
            return string.Format("{0:x}{1}", SmartQuoteLeft, content);
        }
        internal static string AddEndSmartQuotes(string content)
        {
            return string.Format("{0}{1:x}", content, SmartQuoteRight);
        }
        internal static string AddSmartQuotes(string content)
        {
            return string.Format("{0:x}{1}{2:x}", SmartQuoteLeft, content, SmartQuoteRight);
        }
    }
 
I'm kinda baffled and any help would be appreciated.
Thanks,
Dean