ConvertCodePointToString() public method

public ConvertCodePointToString ( string codepoint ) : string
codepoint string
return string
Ejemplo n.º 1
0
        /// <summary>
        /// Build a data table for all of an ASCII character's bestfit mappings.
        /// </summary>
        /// <param name="cAscii">The ASCII character to query on.</param>
        /// <param name="lTransformations">Reference to a List you want to populate with data.</param>
        /// <param name="sTransform">An optional charset to filter results by.</param>
        public void BuildTransformationsTable(char cAscii,
                                              ref List <UnicodeMapping> lTransformations,
                                              string sTransform = "")
        {
            UniChar uc = new UniChar();

            uc.CodePoint = uc.GetCodePoint(cAscii);
            IEnumerable <XElement> query;

            if (String.IsNullOrEmpty(sTransform))
            {
                query = from mapping in xDocUnicode.Descendants("Mapping")
                        where (string)mapping.Element("Ascii") == uc.CodePoint
                        select mapping;
            }
            else
            {
                query = (from mapping in XDocUnicode.Descendants("Mapping")
                         where (string)mapping.Element("Ascii") == uc.CodePoint &&
                         (string)mapping.Element("Transform") == sTransform
                         select mapping);
            }

            var count = query.Count();

            foreach (var item in query.Distinct())
            {
                UnicodeMapping um  = new UnicodeMapping();
                UniChar        uc2 = new UniChar();
                um.Ascii     = item.Element("Ascii").Value;
                um.Unicode   = item.Element("Unicode").Value;
                um.Character = uc2.ConvertCodePointToString(um.Unicode);
                um.Transform = item.Element("Transform").Value;
                um.Name      = item.Element("Name").Value;
                lTransformations.Add(um);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Build a data table for all of an ASCII character's bestfit mappings.
        /// </summary>
        /// <param name="cAscii">The ASCII character to query on.</param>
        /// <param name="lBestFit">Reference to a List you want to populate with data.</param>
        /// <param name="sCharset">An optional charset to filter results by.
        /// </param>
        public void BuildBestfitTable(char cAscii,
                                      ref List <BestFitMapping> lBestFit,
                                      string sCharset = "")
        {
            UniChar uc = new UniChar();

            uc.CodePoint = uc.GetCodePoint(cAscii);
            IEnumerable <XElement> query;

            if (String.IsNullOrEmpty(sCharset))
            {
                query = from mapping in XDocBestfit.Descendants("Mapping")
                        where (string)mapping.Element("Ascii") == uc.CodePoint
                        select mapping;
            }
            else
            {
                query = (from mapping in XDocBestfit.Descendants("Mapping")
                         where (string)mapping.Element("Ascii") == uc.CodePoint &&
                         (string)mapping.Element("Charset") == sCharset
                         select mapping);
            }

            var count = query.Count();

            foreach (var item in query.Distinct())
            {
                BestFitMapping bf  = new BestFitMapping();
                UniChar        uc2 = new UniChar();
                bf.Ascii     = item.Element("Ascii").Value;
                bf.Unicode   = item.Element("Unicode").Value;
                bf.Character = uc2.ConvertCodePointToString(bf.Unicode);
                bf.Charset   = item.Element("Charset").Value;
                bf.Name      = item.Element("Name").Value;
                lBestFit.Add(bf);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Build a data table for all of an ASCII character's bestfit mappings.
        /// </summary>
        /// <param name="cAscii">The ASCII character to query on.</param>
        /// <param name="lBestFit">Reference to a List you want to populate with data.</param>
        /// <param name="sCharset">An optional charset to filter results by.
        /// </param>
        public void BuildBestfitTable(char cAscii, 
            ref List<BestFitMapping> lBestFit,
            string sCharset = "")
        {
            UniChar uc = new UniChar();
            uc.CodePoint = uc.GetCodePoint(cAscii);
            IEnumerable<XElement> query;

            if (String.IsNullOrEmpty(sCharset))
            {
                query = from mapping in XDocBestfit.Descendants("Mapping")
                        where (string)mapping.Element("Ascii") == uc.CodePoint
                        select mapping;
            }
            else
            {
                query = (from mapping in XDocBestfit.Descendants("Mapping")
                            where (string)mapping.Element("Ascii") == uc.CodePoint &&
                                  (string)mapping.Element("Charset") == sCharset
                            select mapping);
            }

            var count = query.Count();
            foreach (var item in query.Distinct())
            {
                BestFitMapping bf = new BestFitMapping();
                UniChar uc2 = new UniChar();
                bf.Ascii = item.Element("Ascii").Value;
                bf.Unicode = item.Element("Unicode").Value;
                bf.Character = uc2.ConvertCodePointToString(bf.Unicode);
                bf.Charset = item.Element("Charset").Value;
                bf.Name = item.Element("Name").Value;
                lBestFit.Add(bf);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Build a data table for all of an ASCII character's bestfit mappings.
        /// </summary>
        /// <param name="cAscii">The ASCII character to query on.</param>
        /// <param name="lTransformations">Reference to a List you want to populate with data.</param>
        /// <param name="sTransform">An optional charset to filter results by.</param>
        public void BuildTransformationsTable(char cAscii,
            ref List<UnicodeMapping> lTransformations,
            string sTransform = "")
        {
            UniChar uc = new UniChar();
            uc.CodePoint = uc.GetCodePoint(cAscii);
            IEnumerable<XElement> query;

            if (String.IsNullOrEmpty(sTransform))
            {
                query = from mapping in xDocUnicode.Descendants("Mapping")
                        where (string)mapping.Element("Ascii") == uc.CodePoint
                        select mapping;
            }
            else
            {
                query = (from mapping in XDocUnicode.Descendants("Mapping")
                         where (string)mapping.Element("Ascii") == uc.CodePoint &&
                               (string)mapping.Element("Transform") == sTransform
                         select mapping);
            }

            var count = query.Count();
            foreach (var item in query.Distinct())
            {
                UnicodeMapping um = new UnicodeMapping();
                UniChar uc2 = new UniChar();
                um.Ascii = item.Element("Ascii").Value;
                um.Unicode = item.Element("Unicode").Value;
                um.Character = uc2.ConvertCodePointToString(um.Unicode);
                um.Transform= item.Element("Transform").Value;
                um.Name = item.Element("Name").Value;
                lTransformations.Add(um);
            }
        }
Ejemplo n.º 5
0
        private void buttonGetUnicode_Click(object sender, EventArgs e)
        {
            textBoxOutput.Text = "";
            List<String> transforms = new List<string>();
            transforms = Data.GetNormalizationMappings(Input);

            string output = String.Empty;

            foreach (string transform in transforms)
            {
                UniChar uc = new UniChar();
                if (!String.IsNullOrEmpty(transform))
                {
                    output += uc.ConvertCodePointToString(transform) + "\r\n";
                }
            }

            textBoxOutput.Text = output;

            // Fill DataGrid
            List<UnicodeMapping> lTransformations = new List<UnicodeMapping>();
            dataGridViewBestFit.DataSource = null;
            Data.BuildTransformationsTable(Input, ref lTransformations, Transform);
            dataGridViewBestFit.DataSource = lTransformations;
        }
Ejemplo n.º 6
0
        private void buttonGetBestfit_Click(object sender, EventArgs e)
        {
            textBoxOutput.Text = "";
            List<String> bestfits = new List<string>();
            bestfits = Data.GetBestfitMappings(Input);

            string output = String.Empty;

            foreach (string bestfit in bestfits)
            {
                UniChar uc = new UniChar();
                if (!String.IsNullOrEmpty(bestfit))
                {
                    output += uc.ConvertCodePointToString(bestfit) + "\r\n";
                }
            }

            textBoxOutput.Text = output;

            // Fill DataGrid
            List<BestFitMapping> lBestfits = new List<BestFitMapping>();
            dataGridViewBestFit.DataSource = null;
            Data.BuildBestfitTable(Input,ref lBestfits, Charset);
            dataGridViewBestFit.DataSource = lBestfits;
        }