Additionally done below procedures
1. Open the project Property Pages dialog box.
2. Select the Configuration Properties > C/C++ > Command Line property page.
3. In Additional Options, add the /utf-8 option to specify your preferred encoding.
4. Choose OK to save your changes.
Last edited by saraswathisrinath; November 21st, 2020 at 05:40 AM.
C:\Windows\System32>mysql -u root -p
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> drop table hindi;
Query OK, 0 rows affected (0.33 sec)
mysql> CREATE TABLE `hindi` ( `data` nvarchar(200) COLLATE utf8_unicode_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Query OK, 0 rows affected (0.50 sec)
INSERT ata using vc++ code. reference image attached.
Output:
Code:
mysql> select * from hindi;
+-----------+
| data |
+-----------+
| ???????? |
| ?????? ?? |
| ?????? ?? |
+-----------+
3 rows in set (0.00 sec)
Re: How to store Hindi characters in MYSQL database
Originally Posted by saraswathisrinath
Getting Output : ?????? ??
If the data doesn't get returned correctly when you do a select query from a my sql browser, then the problem is in how you are setting up the database, not in the C++ code.
Try to not specify utf8 when you create the database, and store the data in a nvarchar type.
You'll want to be able to insert hindi into the table and read it back out with a query in a mysql browser.
Once you can do this successfully, then compile the C++ app as UNICODE and use CString or TCHAR string types amd this will probably just work.
Is any setup/config missed?
Note: Server version: 5.6.14 MySQL default chcp = 437
To change the chcp done below work,
opened Registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor
added a String = Autorun & value = @chcp 65001>nul
Now checked chcp = 65001 from command line
Now changed the command line for Unicode character.
Tried again table creation and insert query. hindi letters not copy in to my command prompt
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.