Click here to Skip to main content
15,881,424 members
Everything / Unicode

Unicode

Unicode

Great Reads

by Doc Lobster
String conversion using the C++ Standard Library only
by Amit Singh Baghel
A useful tip to export a Div to PDF (with Unicode support) with the help of NReco-PDF Generator for .NET (C#), JQuery and Handler in ASP.NET
by Gregory Morse
Rendering Qur'anic (complex Arabic) scripts with Unicode in a PDF
by Michael Haephrati
A Static Library which can be used for all kinds of database related needs

Latest Articles

by Member 15078716
Unicode / Creating, Writing, Appending / a text (*.txt) file - how to do it
by Michael Haephrati
A Static Library which can be used for all kinds of database related needs
by DebugST
Use [Unicode 14.0.0] version. Can support automatic code generation according to the latest version.
by honey the codewitch
Add UTF-32 support and easy foreach streaming to your apps

All Articles

Sort by Score

Unicode 

16 Feb 2011 by Sergey Alexandrovich Kryukov
There is a number of issues about it. There is no need to support surrogate pairs, they are supported automatically by OS (Windows 2000 needs a tweak to support them, later versions of Windows are bundled with surrogate support).The notion of surrogate pair is only relevant to two UTF-16...
15 May 2011 by Doc Lobster
String conversion using the C++ Standard Library only
16 Feb 2011 by Espen Harlinn
"As I understand it, .Net represents 32-bit characters using a pair (or "surrogate pair") of 16-bit characters".Net uses UTF16 - and you may find this interesting:http://www.unicode.org/notes/tn12/[^]and this http://www.yoda.arachsys.com/csharp/unicode.html[^]Libraries like...
21 Mar 2015 by Amit Singh Baghel
A useful tip to export a Div to PDF (with Unicode support) with the help of NReco-PDF Generator for .NET (C#), JQuery and Handler in ASP.NET
9 Mar 2015 by Gregory Morse
Rendering Qur'anic (complex Arabic) scripts with Unicode in a PDF
8 Jan 2022 by Michael Haephrati
A Static Library which can be used for all kinds of database related needs
25 Aug 2010 by CPallini
Windows and UNIX (and Linux) implement dynamic linking in different ways. See Wikipedia on dynamic linking[^] for info about. :)
17 Apr 2012 by Shahin Khorshidnia
HelloLook at this: Console Code PagesMaybe this helps: C#: How to print a unicode string to console?
18 Feb 2014 by yetibrain
If you character is beyond the BMP (and 2A601 is > 0xFFFF e. g. decimal 173569) then you will have a high- as well as low-surrogate within your string that encodes your codepoint. This means that TWO elements e. g. TWO words encode ONE character. Length will always obtain the number of array...
21 Nov 2017 by Patrice T
SqlCommand cmd = new SqlCommand("insert into FileContent values(" + readText + ")", con); Not a solution to your question, but another problem you have. Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability...
22 Oct 2020 by CPallini
Quote: Do i have to define UNICODE in every single source file? Yes, you have to. You might, however, define it as a compiler option, see /D (Preprocessor Definitions)- To set this compiler option in the Visual Studio development environment |...
16 Aug 2010 by Richard MacCutchan
Your starting point seems incorrect; you cannot have Unicode characters in an array defined as char* pData. This is (at best) multibyte data so doing a straight memcpy() to a wchar_t array still leaves you with multibyte characters. As Superman mentioned you need to convert it to Unicode...
14 Oct 2010 by Smithers-Jones
Tell Chris Maunder in Suggestions and Bugs-Forum to delete it.
14 Oct 2010 by William Winner
see here: Code Project Member FAQ[^]
29 Aug 2011 by Prerak Patel
You need to use collationhttp://msdn.microsoft.com/en-us/library/ms143508(v=sql.90).aspx[^]ALTER COLUMN Column1 NVARCHAR(100)COLLATE Indic_General_90_CI_AS
16 Dec 2011 by Pascal Ganaye
A custom C# string implementation that stores its data in a UTF8 byte array.
2 Nov 2012 by Jochen Arndt
If the text from the requested web site uses UTF-8 encoding, it must be converted to show it in a mesage box:// Use char here. InternetReadFile() reads bytes.char buffer[100];DWORD bytesRead;InternetReadFile(hRequest, buffer, sizeof(buffer), &bytesRead);// Get size of converted...
12 May 2013 by Richard MacCutchan
If you are using Visual Studio then make sure that your Project -> Properties -> General -> Character Set has Unicode selected. Then you can use all the Unicode versions of the string classes, and use the L prefix on your Unicode string constants like:wstring myString = L"Hello, World!...
10 Jul 2013 by TorstenH.
Working with non-ASCII Fonts can be a real pain.Stick to UTF-8, that will make it better for you. UTF-8 is kind of a ASCII-konform encoding for non-ASCII characters.You can use the class Font[^] for that.Please also check out some of the following:- internationalization-...
16 May 2014 by ZurdoDev
It could be a couple of issues which is what SA was getting at.See http://stackoverflow.com/questions/420659/unicode-characters-not-showing-in-system-windows-forms-textbox[^]The textbox does support Unicode but it may be the font you are using or it may be that the font you need is not...
15 Jan 2015 by Sergey Alexandrovich Kryukov
You should never assume any particular UTF encoding. All the .NET API is well abstracted from this representation. Remember that with all UTFs except UTF-32, the characters are represented using different number of bytes. With UTF-16, characters beyond BMP are encoded using surrogate pairs. You...
4 Dec 2015 by Kobayashi Porcelain
I have a university assignment i need some help with. Don't give me the solution; hints or small portions of code would be appreciated.So, my university project is all about unicode. To be exact, I have to write code that takes character input in utf-16 format, converts it to utf-8 and...
4 Dec 2015 by Sergey Alexandrovich Kryukov
First, you did not show how your objects named char… are declared. You need to do all the calculations on 32-bit unsigned integer; in other cases, the size would be not enough to represent a code point beyond BMP.I did not check up UTF16 part, but at least one part is missing: there...
9 Jun 2016 by Sergey Alexandrovich Kryukov
This is a very unpleasant problem, but, most likely, not hard to solve. I would start it from the detection of what is that encoding. I don't know which one is the most likely, but I know quite a few ones for Chinese, Simplified or Traditional. Based on that information, you may start looking...
20 Jun 2018 by Amir No-Family
Simply use: var output = System.Net.WebUtility.HtmlDecode(text);
22 Oct 2020 by Richard MacCutchan
You can define it in the Project Properties in the Advanced -> Character Set box. This will ensure that all source files will be compiled with /D "UNICODE" as standard.
27 Jun 2022 by merano99
For UTF-8 you code this: DWORD dwBytesWritten = 0; BOOL bErr = 0; TCHAR *fname = TEXT("A_Unicode_WriteSTuff_天_file.txt"); HANDLE hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);...
10 Jan 2016 by WernfriedD
How to set NLS_LANG value for Oracle to support all special characters you need in your language/application.
2 Oct 2023 by JudyL_MD
This has nothing to do with WinUI 3. Use of the L prefix on a string is a feature of the C / C++ language, independent of any preprocessor defines. An MBCS program can need the ability to use a UNICODE string, say when talking to an API that only...
2 Oct 2023 by Rick York
JudyL_MD is correct but there are a few more details involved. Nearly all of the Windows API comes in MBCS and Unicode flavors. The function LoadLibrary is one example. That function actually does not exist. There is LoadLibraryA and...
6 Jun 2010 by Susobhan
I have some confusion regarding WideCharToMultiByte function - we need to pass the codepage of the multibyte string in the first param of the function - Now my confusion is why this param is required? As the every unicode character is unique and there is no overlap so where this is required?...
25 Aug 2010 by #realJSOP
Because a DLL isn't a unix format. I think you want to build a .SO file, and for that, you need a unix compiler.
28 May 2021 by shilky
Hi...I am using Sendkeys.SendWait method in my project for sending characters, using unicode code points, to the Office Applications in Windows XP, Windows Vista and Windows 7. In this method, the unicode code point for Devnagari Characters are working nicely but the unicode code point...
1 Oct 2010 by Be Yourself
Make sure wheather you are using the same type of keyboard configuration or change the keypad configurations from control panel and try again.
12 Jan 2018 by jessiefun
There is some problem while I want to export data to csv file: public void ExportLoalDataToCSV(DataTable dt, string fileName) { FileStream fs = new FileStream(fileName, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.Unicode); ...
18 Nov 2010 by ARopo
Either come up with an escape sequence for comma e.g. &comma& then replace this with , after the split.or put each field in '' quotes and parse the string to ignore commas in between quotesor use a more unlikely character to separate your fields e.g. ^ instead of comma
7 Jan 2011 by Espen Harlinn
cstring cbuff;if(buff && (buff[0] != 0 )){ cbuff = cstring(buff);}RegardsEspen Harlinn
7 Jan 2011 by #realJSOP
Did you try this:cbuff = (LPCWSTR)buff;
15 Jan 2011 by Espen Harlinn
This is a great project:ICU - International Components for Unicode[^], it will do the job on windows and linux.RegardsEspen Harlinn
21 Jan 2011 by Espen Harlinn
Sound like the font doesn't not include the required characters. Not all fonts support all unicode code points.RegardsEspen Harlinn
29 Jan 2011 by weylspinor
Dear Colleagues,I'm attempting to use a dialog box to select the filename of an AVI file that I want to use in OpenCV. The OpenCV function is called: cvCaptureFromAVI. To create the Open File dialog box, I am using the Windows function:GetOpenFileNameI suspect that the trouble I am...
16 Mar 2011 by JoeAndrieu
I've been using wininet in a client-side application in Unicode mode. Mostly, it's working.I put the download into a char* buffer and build out a std::string on each InternetReadFile. Since I think I'm getting a UTF8 encoding web page, I use CA2W(buffer,CP_UTF8) to convert after I've downloaded...
29 May 2011 by arminamini
I dont know why, but i found out it u use response.redirect("with unicode text"); u cant see the unicode text in IE.But if u use Hyperlink or (a Tag) u can see the unicode in URL currectly.For example :
27 Jun 2011 by Sergey Alexandrovich Kryukov
"ASCII Code Arabic" is oxymoron (see http://en.wikipedia.org/wiki/Oxymoron[^], sorry, I did not find Arabic version of this Wikipedia article :-)). ASCII is 7-bit code or 8-bit code with unused high bit (=0), so all code points integer values are below the value of 128. Arabic is supported as...
30 Aug 2011 by André Kraak
When reading the ANSI file in a UNICODE build you first need to read the data into a char buffer and then convert the text into a UNICODE string for further processing.Please note that your code does not handle the possible presence of a BOM (Byte Order Mark) in the file. This article[^] on...
6 Jan 2012 by DrBones69
Maybe this article will get you started in the right direction.
28 Mar 2012 by Sergey Alexandrovich Kryukov
How? The answer is: easily. Because these days most systems support Unicode.Further detail depend on such boring things as platform, language, used libraries, etc. It does not look like you care too much about that. :-)[EDIT: in response to a follow-up question]With C++, you need to...
17 Apr 2012 by Eugene Sadovoi
The solution to your problem explained in details at this link[^].The code from this blog is here (I have nothing to do with this code, it is simply cut/paste):using System;using System.Runtime.InteropServices;public class Test { public static void Main() { ...
11 Jun 2012 by nv3
That could be a font problem. Not all fonts contain the same character set and particularly not all contain support for the Asian character sets. So, if Word, Firefox, etc. are using a different font they might be doing ok, while your application and Notepad are using an incomplete font and you...
4 Nov 2012 by Barakat S.
I made some modifications on the code you posted, I assumed that your web page uses utf-8:Test web application:#!python# -*- coding: utf-8 -*-from bottle import *content_type = 'text/html; charset=utf-8'@route("/ar/")def ar(): response.content_type = content_type ...
27 Dec 2012 by Suvabrata Roy
Hi,String.Equals don't have any overload on byte array, when you pass byte array to equals function that treated as object, so no compilation error occur but it's returns false.:)
1 Jun 2013 by Sergey Alexandrovich Kryukov
Yes, setting up a proper font, in particular, Arial Unicode MS, should solve the problem. I have no idea why you failed to do that, as you did not explain how you tried. This is really simple thing.To check up what character repertoire is supported by what form, use the application which is...
20 Jun 2013 by TnTinMn
You have a downloaded text file in UTF-8 format. You must you have read the file to get that string. So why not set the encoding when you read it and let reader do the conversion?' set monospaced fontTextBox1.Font = New System.Drawing.Font("DejaVu Sans Mono", 10, _ ...
8 Sep 2013 by Sergey Alexandrovich Kryukov
MBCS is not any specific encoding. In particular, Unicode UTF-8 and UTF-16 are also classified as MBCS: http://en.wikipedia.org/wiki/Multi-byte_character_set[^].In this respect, the question makes no sense, as you did not specify what non-Unicode MBCS encoding do you need and why. But let's...
3 Dec 2013 by StoyanovZ
Hi! I'm reworking on an old project(not started by me). I'm replacing the old dialog with a frame, so that I can put a ribbon instead of the menubar(that's the task). So... The original project doesn't work with Unicode, but in the frame's OnCreate method I need widechar strings for this...
3 Dec 2013 by Philippe Mori
I would suggest that you convert the part that does not works presently to works in Unicode.We are almost in 2014 so you are more than 10 years late to convert your application to Unicode. In 2000's, it was already possible to write Unicode program on Win 9x using Microsoft Layer for Unicode...
4 Dec 2013 by StoyanovZ
I simply had forgotten to describe the needed items in the .rc file :D
4 Dec 2013 by nxc121
Ok i could read the unicode file but now i see that i get the entire file in one string and now i am unable to break it in line and then words. I am very confused. i had previous post but since the problem is different now i am posting new ques. objective: - i want to filter some words from the...
17 Dec 2013 by CPallini
Quote:Can I modify my VB code or replace controls with third party controls to support unicode? In principle you could do it (and Google is your friend[^]).However my advice is to completely rewrite it using C#.
17 Jan 2014 by Richard MacCutchan
I tested your code and received the error EILSEQ (42), which indicates that a character was found in the string that cannot be converted.[edit]Feedback from OP suggests that the WideCharToMultiByte function has been used to resolve the problem.[/edit]
21 Jan 2014 by Member 10518995
c# please i want to write a function that takes a unicode value and return it to its original code , could anyone help me with this ?
11 Jan 2018 by gokings
SEEKING ADVICE REGARDING CONVERSION TO UNICODEWHY I AM ADOPTING UNICODE SO LATE[Feel free to skip to "The Situation", below, but if you do, please don't flame me for "waiting so long".]I'm a former professional software engineer and programmer.I was "away" from programming for...
19 May 2014 by TrushnaK
Change your data type of database from nvarchar to NTEXT. It will solve your problem.
2 Jun 2014 by DamithSL
char myValue = Char.Parse("\u2602");convert back to string string str = string.Format(@"\u{0:x4}", (int)myValue);if you need string string myValue = Char.Parse("\u2602").ToString();
22 Apr 2015 by Kyudos
I have this working in my 32 bit unicode build:// Open and delete the Log FileLogFile.open(m_LogFilePath, std::ofstream::out | std::ofstream::binary);// Check for a file open failureif (LogFile.fail() != 0){ Prompt.LoadString(IDE_FILE_OPEN_ERR); AfxMessageBox((Prompt + "\n") +...
22 Apr 2015 by Richard MacCutchan
Yes, see https://msdn.microsoft.com/en-us/library/f1d6b0fk.aspx[^].
11 Jul 2015 by Ahmad Haghighi
You can use this function: System.Uri.UnescapeDataString(string) I test it for you:string unicode = "\u0633\u0637\u0648\u0631 \u0639\u0628\u0631 \u0627\u0644\u0623\u064a\u0627\u0645 1"; string str = System.Uri.UnescapeDataString(unicode);result (str content) is:سطور...
14 Jan 2016 by _Asif_
You need to have a translation API and the process is quite simple. All you need to do is to call the API (either your own or free translation engine available) on submit button and show the translated text in the other textbox. Try google yourself and see below references* translation -...
10 Jun 2016 by Sergey Alexandrovich Kryukov
After the discussion over Solution 1 (please see):Now when we know the original code page, one possible work-around could be using Microsoft AppLocale utility:AppLocale — Wikipedia, the free encyclopedia,http://ntu.csie.org/~piaip/papploc.msi,Microsoft AppLocale 1.3 Download (Free) —...
1 Feb 2017 by Daniel Pfeffer
As you have the source code for CppSqlite , you could always write an additional (Unicode) method as follows:SQLITE_API int sqlite3_execW( sqlite3*, /* An open database */ const wchar_t *sql, /* SQL to be evaluated...
3 Sep 2017 by OriginalGriff
That's because although @text is NVARCHAR, the string 'सम्पति' isn't - its VARCHAR. Try this: declare @text nvarchar(max) =N'सम्पति' select @text The "N" prefix tells SQL it's a NVARCHAR constant.
17 Nov 2017 by RedDk
Try: BULK INSERT Filecontent FROM 'myfilepath' WITH (DATAFILETYPE='widechar', FIELDTERMINATOR='none' );
16 Dec 2017 by JustWatchLittle
c# strings are Unicode strings. It represents text as a sequence of UTF-16 code units. Read e.g. this: String Class (System)[^] [Edit] Not a short read, but to understand unicode, you most probably Need to go through several articles liek this: Unicode and You – BetterExplained[^] [Edit1]...
11 Jan 2018 by Michael Haephrati
Here are most of the stages you need to take when converting an old project (defined as Use Multi-Byte Character Set or Not Set in Project -> Properties -> General -> Character Set. First you set this attribute to Unicode. 1. You will then have to change any hardcoded string to from...
12 Jan 2018 by Michael Haephrati
The solution I have found to similar problems was to insert a BOM character to the .CSV file to indicate its encoding. CSV and BOM character - CSV[^] If you even inserted a UNICODE character to a Notepad file, and tried to save it, you would have seen a warning that the contents of the file will...
9 Aug 2019 by Gerry Schmitz
If you're just "streaming", there's no need to be concerned about "encoding". The "text" contains Greek Unicode or it doesn't. Use the correct Font for the range of codes and it will display properly; otherwise not. That's it.
21 Jan 2020 by KarstenK
Unocode support is mostly a project setting. So you better read in the manual or some support documents. At last you could contact the vendor of this rarely used product.
14 Apr 2020 by steveb
Do your other 15% users use computer language configuration set to EN(US)?
25 Jul 2020 by Rick York
This should work const wchar_t * wstring = L"some wide string"; wprintf( L"%s\n", wstring ); for a string. For a single character try this : wchar_t wideChar = 0x1234; wprintf( L"hex: %04X char: %c\n", wideChar, wideChar );
8 Nov 2021 by DebugST
Use [Unicode 14.0.0] version. Can support automatic code generation according to the latest version.
9 Aug 2022 by Member 15078716
I have the following. It shows up correctly in Microsoft NotePad. It does not show up correctly in Microsoft Wordpad. Using CodeBlocks 17.12 / MinGW with GCC 5.1 / 32 bit Microsoft Windows XP Pro sp2. __________ When I open the txt file with...
2 Jul 2022 by CPallini
Quote: LPVOID lpBuffer; // An LPCVOID is a 32-bit pointer to a constant of any type. // This type is declared as follows: // typedef const void* LPCVOID; const char* pString_from_lpBuffer; ...
2 Jul 2022 by Daniel Pfeffer
It is possible to do this in standard C, but it depends on whether your compiler supports the UTF-8 character encoding. See the setlocale and mbstowcs functions for details. Once the data are converted to wide characters, you may use the wcsXXX...
9 Aug 2022 by Michael Haephrati
The code should work, however your code has issues and errors (dwBytesWritten and hFile are undefined). Here is the fixed code. HANDLE hDFile = CreateFile(L"utf8_UsingByteOrderMark_C_天堂.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL,...
4 Aug 2023 by Andre Oosthuizen
Not my expertise in the least but I found this very interesting. Some research later I found the following, whether it will solve your issue completely, I am not sure but it might point you in the right direction. First of all, a warning from...
19 May 2010 by Jyotishaji
I am working in a MFC C++ project. There is a requirement for Arabic language support in the application. I tried using the ARABIC_CHARSET in the code, but does not seem to work. If I copy the Arabic characters from the charmap, upon pasting in the edit control, the characters are changing to...
23 Jun 2010 by vijay.victory
Hi Experts, I have written one program which handles some Tables containing Unicode Values. I want to search those values by passing a Unicode Value.What should I DO??I have write following code, which seems to be right, but could not return any records.Can you help..Its...
23 Jun 2010 by Single Step Debugger
Why you are not using _T("") and LPCTSTR instead of unsigned short for Unicode character in the funcion arguments?
27 Jul 2010 by sajesh123
hi,Please tell me how to display unicode data from sql 2005 in vb.net 2.0 windows forms combobox.I am able to store values in database, but when it is disalying it is coming as boxes.
28 Jul 2010 by Peace ON
You can try following code.//Code starts herestatic void convertunicode(){string unicodeString = "This string contains the unicode character Pi(\u03a0)";// Create two different encodings.Encoding ascii = Encoding.ASCII;Encoding unicode = Encoding.Unicode;// Convert the...
16 Aug 2010 by rudrik
Code Snippet:int Convertchar_wchar(char* pData, int pDataLength){ wchar_t wcsQuery[4096*2 + 2]; memcpy((void*)wcsQuery, pData, pDataLength) wcout
17 Aug 2010 by rudrik
The thing is that its a legacy code which i need to enhance. The data is actually coming was unicode from a java application over the wire.Till now unicode work good for Japanese data on Japanese OS or Chinese data on Chinese OS. The problem I am facing is to support this languages in...
23 Aug 2010 by Deiveegaraja Andaver
How can i learn Linux shell scripting..Pls provide the weblink and some other useful sites..
23 Aug 2010 by Nyarost
What shell? bash? zsh? ....For bash great manual can be found by simply googling "bash reference":here.Hey, man, it's the first link.
25 Aug 2010 by sindhusagar
Why does DLL not work in UNIX environment?
3 Oct 2010 by KaRaMiLo
Hello , i want to know if Solaris 10 supports arabic or not ?if not plz tell me how to make it ??thnx in advance.
3 Oct 2010 by Richard MacCutchan
Try researching first, you may be surprised at the answers: such as these[^].
3 Oct 2010 by Abhinav S
As per this[^] chart, yes.
12 Oct 2010 by rowdykuttan
Hi allI am looking for some help in converting postscript font to unicode using C#. Advice or samples are highly appreciatedThanks