Background
Break News
How to add local font to Tailwind Css and NextJS? - Tutorial Design Pattern? - Blockchain Technology, How to create own Bitcoin virtual currency - Zustand mordern management state - Design Pattern - Flyweight Pattern? - Docker Full training Topic

[Tips] A Guide to TCVN3 Character Reading in Various Processes

Friday, 11 March 2016
|
Read: Completed in minutes

[Tips] A Guide to TCVN3 Character Reading in Various Processes

Last weekend is comming, wishes you all healthy and successful in the life :)

How many languages (national) is how much code page. So this is so hard for develop code with native font. View below link please:
Có rất nhiều codepage: xem link bên dưới:






This code produces the following output.

Info.CodePage      Info.Name                    Info.DisplayName
37                 IBM037                       IBM EBCDIC (US-Canada)      
437                IBM437                      OEM United States           
500                IBM500                      IBM EBCDIC (International)   
708                ASMO-708                 Arabic (ASMO 708)           
720                DOS-720                     Arabic (DOS)                
737                ibm737                        Greek (DOS)                 
775                ibm775                        Baltic (DOS)                
850                ibm850                        Western European (DOS)      
852                ibm852                        Central European (DOS)      
855                IBM855                       OEM Cyrillic                
857                ibm857                        Turkish (DOS)               
858                IBM00858                    OEM Multilingual Latin I    
860                IBM860                       Portuguese (DOS)            
861                ibm861                        Icelandic (DOS)             
862                DOS-862                     Hebrew (DOS)                
863                IBM863                       French Canadian (DOS)       
864                IBM864                       Arabic (864)                
865                IBM865                       Nordic (DOS)                
866                cp866                          Cyrillic (DOS)              
869                ibm869                        Greek, Modern (DOS)         
870                IBM870                       IBM EBCDIC (Multilingual Latin-2)   
874                windows-874               Thai (Windows)              
875                cp875                        IBM EBCDIC (Greek Modern)   
932                shift_jis                    Japanese (Shift-JIS)        
936                gb2312                       Chinese Simplified (GB2312)   
949                ks_c_5601-1987               Korean                      
950                big5                         Chinese Traditional (Big5)   
1026               IBM1026                      IBM EBCDIC (Turkish Latin-5)   
1047               IBM01047                     IBM Latin-1                 
1140               IBM01140                     IBM EBCDIC (US-Canada-Euro)   
1141               IBM01141                     IBM EBCDIC (Germany-Euro)   
1142               IBM01142                     IBM EBCDIC (Denmark-Norway-Euro)   
1143               IBM01143                     IBM EBCDIC (Finland-Sweden-Euro)   
1144               IBM01144                     IBM EBCDIC (Italy-Euro)     
1145               IBM01145                     IBM EBCDIC (Spain-Euro)     
1146               IBM01146                     IBM EBCDIC (UK-Euro)        
1147               IBM01147                     IBM EBCDIC (France-Euro)    
1148               IBM01148                     IBM EBCDIC (International-Euro)   
1149               IBM01149                     IBM EBCDIC (Icelandic-Euro)   
1200               utf-16                       Unicode                     
1201               unicodeFFFE                  Unicode (Big-Endian)        
1250               windows-1250                 Central European (Windows)   
1251               windows-1251                 Cyrillic (Windows)          
1252               Windows-1252                 Western European (Windows)   
1253               windows-1253                 Greek (Windows)             
1254               windows-1254                 Turkish (Windows)           
1255               windows-1255                 Hebrew (Windows)            
1256               windows-1256                 Arabic (Windows)            
1257               windows-1257                 Baltic (Windows)            
1258               windows-1258                 Vietnamese (Windows)        
1361               Johab                        Korean (Johab)              
10000              macintosh                    Western European (Mac)      
10001              x-mac-japanese               Japanese (Mac)              
10002              x-mac-chinesetrad            Chinese Traditional (Mac)   
10003              x-mac-korean                 Korean (Mac)                
10004              x-mac-arabic                 Arabic (Mac)                
10005              x-mac-hebrew                 Hebrew (Mac)                
10006              x-mac-greek                  Greek (Mac)                 
10007              x-mac-cyrillic               Cyrillic (Mac)              
10008              x-mac-chinesesimp            Chinese Simplified (Mac)    
10010              x-mac-romanian               Romanian (Mac)              
10017              x-mac-ukrainian              Ukrainian (Mac)             
10021              x-mac-thai                   Thai (Mac)                  
10029              x-mac-ce                     Central European (Mac)      
10079              x-mac-icelandic              Icelandic (Mac)             
10081              x-mac-turkish                Turkish (Mac)               
10082              x-mac-croatian               Croatian (Mac)              
12000              utf-32                       Unicode (UTF-32)            
12001              utf-32BE                     Unicode (UTF-32 Big-Endian)   
20000              x-Chinese-CNS                Chinese Traditional (CNS)   
20001              x-cp20001                    TCA Taiwan                  
20002              x-Chinese-Eten               Chinese Traditional (Eten)   
20003              x-cp20003                    IBM5550 Taiwan              
20004              x-cp20004                    TeleText Taiwan             
20005              x-cp20005                    Wang Taiwan                 
20105              x-IA5                        Western European (IA5)      
20106              x-IA5-German                 German (IA5)                
20107              x-IA5-Swedish                Swedish (IA5)               
20108              x-IA5-Norwegian              Norwegian (IA5)             
20127              us-ascii                     US-ASCII                    
20261              x-cp20261                    T.61                        
20269              x-cp20269                    ISO-6937                    
20273              IBM273                       IBM EBCDIC (Germany)        
20277              IBM277                       IBM EBCDIC (Denmark-Norway)   
20278              IBM278                       IBM EBCDIC (Finland-Sweden)   
20280              IBM280                       IBM EBCDIC (Italy)          
20284              IBM284                       IBM EBCDIC (Spain)          
20285              IBM285                       IBM EBCDIC (UK)             
20290              IBM290                       IBM EBCDIC (Japanese katakana)   
20297              IBM297                       IBM EBCDIC (France)         
20420              IBM420                       IBM EBCDIC (Arabic)         
20423              IBM423                       IBM EBCDIC (Greek)          
20424              IBM424                       IBM EBCDIC (Hebrew)         
20833              x-EBCDIC-KoreanExtended      IBM EBCDIC (Korean Extended)   
20838              IBM-Thai                     IBM EBCDIC (Thai)           
20866              koi8-r                       Cyrillic (KOI8-R)           
20871              IBM871                       IBM EBCDIC (Icelandic)      
20880              IBM880                       IBM EBCDIC (Cyrillic Russian)   
20905              IBM905                       IBM EBCDIC (Turkish)        
20924              IBM00924                     IBM Latin-1                 
20932              EUC-JP                       Japanese (JIS 0208-1990 and 0212-1990)   
20936              x-cp20936                    Chinese Simplified (GB2312-80)   
20949              x-cp20949                    Korean Wansung              
21025              cp1025                       IBM EBCDIC (Cyrillic Serbian-Bulgarian)   
21866              koi8-u                       Cyrillic (KOI8-U)           
28591              iso-8859-1                   Western European (ISO)      
28592              iso-8859-2                   Central European (ISO)      
28593              iso-8859-3                   Latin 3 (ISO)               
28594              iso-8859-4                   Baltic (ISO)                
28595              iso-8859-5                   Cyrillic (ISO)              
28596              iso-8859-6                   Arabic (ISO)                
28597              iso-8859-7                   Greek (ISO)                 
28598              iso-8859-8                   Hebrew (ISO-Visual)         
28599              iso-8859-9                   Turkish (ISO)               
28603              iso-8859-13                  Estonian (ISO)              
28605              iso-8859-15                  Latin 9 (ISO)               
29001              x-Europa                     Europa                      
38598              iso-8859-8-i                 Hebrew (ISO-Logical)        
50220              iso-2022-jp                  Japanese (JIS)              
50221              csISO2022JP                  Japanese (JIS-Allow 1 byte Kana)   
50222              iso-2022-jp                  Japanese (JIS-Allow 1 byte Kana - SO/SI)   
50225              iso-2022-kr                  Korean (ISO)                
50227              x-cp50227                    Chinese Simplified (ISO-2022)   
51932              euc-jp                       Japanese (EUC)              
51936              EUC-CN                       Chinese Simplified (EUC)    
51949              euc-kr                       Korean (EUC)                
52936              hz-gb-2312                   Chinese Simplified (HZ)     
54936              GB18030                      Chinese Simplified (GB18030)   
57002              x-iscii-de                   ISCII Devanagari            
57003              x-iscii-be                   ISCII Bengali               
57004              x-iscii-ta                   ISCII Tamil                 
57005              x-iscii-te                   ISCII Telugu                
57006              x-iscii-as                   ISCII Assamese              
57007              x-iscii-or                   ISCII Oriya                 
57008              x-iscii-ka                   ISCII Kannada               
57009              x-iscii-ma                   ISCII Malayalam             
57010              x-iscii-gu                   ISCII Gujarati              
57011              x-iscii-pa                   ISCII Punjabi               
65000              utf-7                        Unicode (UTF-7)             
65001              utf-8                        Unicode (UTF-8) 







Vietnamese Version Today I'll show you how to read TCVN3 character in any process - C# programming language
Mình sẽ chỉ các bạn cách đọc TCVN3 (window-1258) trong C#

If you use ASCII, you will received the character with ? character.
- Use ASCII received: Tr?i Cung, T?
Nếu bạn dùng ASCII bạn sẽ nhận được các ký tự sau: Tr?i Cung, T?

If you use Uncode, you will received the character with #? character.
- Use Unicode received: T#?i Cu#g, T?#

Nếu bạn dùng Unicode bạn sẽ nhận được các ký tự sau: T#?i Cu#g, T?#

Please look:

Code:
ASCIIEncoding enc = new ASCIIEncoding();    // không dùng ASCII
enc.GetString(Read(Address, length));



A Guide to TCVN3 Character Reading in Various Processes - Webzone Tech Tips Zidane

Code:

             
Encoding enc = Encoding.GetEncoding(1258);  // tiếng việt TCVN3    
return clsConvert.TCVN3ToUnicode(enc.GetString(Read(Address, length)));

// ---------------- clsConvert.cs ------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Auto_PhongThan
{
    public static class clsConvert
    {        
        private static char[] tcvnchars = 
        {
            'µ', '¸', '¶', '·', '¹',
            '¨', '»', '¾', '¼', '½', 'Æ',
            '©', 'Ç', 'Ê', 'È', 'É', 'Ë',
            '®', 'Ì', 'Ð', 'Î', 'Ï', 'Ñ',
            'ª', 'Ò', 'Õ', 'Ó', 'Ô', 'Ö',
            '×', 'Ý', 'Ø', 'Ü', 'Þ',
            'ß', 'ã', 'á', 'â', 'ä',
            '«', 'å', 'è', 'æ', 'ç', 'é',
            '¬', 'ê', 'í', 'ë', 'ì', 'î',
            'ï', 'ó', 'ñ', 'ò', 'ô',
            '­', 'õ', 'ø', 'ö', '÷', 'ù',
            'ú', 'ý', 'û', 'ü', 'þ',
            '¡', '¢', '§', '£', '¤', '¥', '¦'
        };

        private static char[] unichars = 
        {
            'à', 'á', 'ả', 'ã', 'ạ',
            'ă', 'ằ', 'ắ', 'ẳ', 'ẵ', 'ặ',
            'â', 'ầ', 'ấ', 'ẩ', 'ẫ', 'ậ',
            'đ', 'è', 'é', 'ẻ', 'ẽ', 'ẹ',
            'ê', 'ề', 'ế', 'ể', 'ễ', 'ệ',
            'ì', 'í', 'ỉ', 'ĩ', 'ị',
            'ò', 'ó', 'ỏ', 'õ', 'ọ',
            'ô', 'ồ', 'ố', 'ổ', 'ỗ', 'ộ',
            'ơ', 'ờ', 'ớ', 'ở', 'ỡ', 'ợ',
            'ù', 'ú', 'ủ', 'ũ', 'ụ',
            'ư', 'ừ', 'ứ', 'ử', 'ữ', 'ự',
            'ỳ', 'ý', 'ỷ', 'ỹ', 'ỵ',
            'Ă', 'Â', 'Đ', 'Ê', 'Ô', 'Ơ', 'Ư'
        };

        private static char[] convertTable;

        static clsConvert() 
        {           
            convertTable = new char[256];

            for (int i = 0; i < 256; i++)
                convertTable[i] = (char)i;

            for (int i = 0; i < tcvnchars.Length; i++)
                convertTable[tcvnchars[i]] = unichars[i];            
        }

        // ----------------------------------------------
        public static string UnicodeToTCVN3(string value)
        {      
            char[] chars = value.ToCharArray();
            for (int i = 0; i < chars.Length; i++)
                if (chars[i] < (char)256)
                    chars[i] = convertTable[chars[i]];
            return new string(chars);
        }                

        public static string TCVN3ToUnicode(string value)
        {      
            char[] chars = value.ToCharArray();
            for (int i = 0; i < chars.Length; i++)
                if (chars[i] < (char)256)
                    chars[i] = convertTable[chars[i]];
            return new string(chars);
        }
    }
}

A Guide to TCVN3 Character Reading in Various Processes - Webzone Tech Tips Zidane

Note:
Because IDE Visual Studio don't support Type TCVN3 character to cs file. So we can use Unikey set TCVN3 and type it on the notepad and then copy to Visual Studio IDE
Vỉ Visual Studio không hỗ trợ  gõ TCVN3 lên file cs, nên chúng ta có thể dùng unikey để viết chữ format TCVN3 lên notepad, sau đó copy lên file cs của (IDE Visual Studio)

Thank you for reading this post. I hope you found it helpful and easy to follow. If you have any feedback or questions about A Guide to TCVN3 Character Reading in Various Processes , please share them in the comments below. I would love to hear from you and discuss this topic further
✋✋✋✋  Webzone Tech Tips, all things Tech Tips for web development  - I am Zidane, See you next time soon ✋✋✋✋

🙇🏼🙇🏼 We Appreciate Your Comments and Suggestions - Webzone, all things Tech Tips web development
Popular Webzone Tech Tips topic maybe you will be like it - by Webzone Tech Tips - Zidane
As a student, I found Blogspot very useful when I joined in 2014. I have been a developer for years . To give back and share what I learned, I started Webzone, a blog with tech tips. You can also search for tech tips zidane on Google and find my helpful posts. Love you all,

I am glad you visited my blog. I hope you find it useful for learning tech tips and webzone tricks. If you have any technical issues, feel free to browse my posts and see if they can help you solve them. You can also leave a comment or contact me if you need more assistance. Here is my blog address: https://learn-tech-tips.blogspot.com.

My blog where I share my passion for web development, webzone design, and tech tips. You will find tutorials on how to build websites from scratch, using hot trends frameworks like nestjs, nextjs, cakephp, devops, docker, and more. You will also learn how to fix common bugs on development, like a mini stackoverflow. Plus, you will discover how to easily learn programming languages such as PHP (CAKEPHP, LARAVEL), C#, C++, Web(HTML, CSS, javascript), and other useful things like Office (Excel, Photoshop). I hope you enjoy my blog and find it helpful for your projects. :)

Thanks and Best Regards!
Follow me on Tiktok @learntechtips and send me a direct message. I will be happy to chat with you.
Webzone - Zidane (huuvi168@gmail.com)
I'm developer, I like code, I like to learn new technology and want to be friend with people for learn each other
I'm a developer who loves coding, learning new technologies, and making friends with people who share the same passion. I have been a full stack developer since 2015, with more than years of experience in web development.
Copyright @2022(November) Version 1.0.0 - By Webzone, all things Tech Tips for Web Development Zidane
https://learn-tech-tips.blogspot.com