How to insert Indian rupee symbol into database (Oracle 10g, MySql 5.0 and Sql Server 2008)?

How to insert Indian rupee symbol into database (Oracle 10g, MySql 5.0 and Sql Server 2008)?

In fact, I had one table "Currency", in which 2 fields resemble "currencyName" and "currencysymbol", so as if to insert a new rupee symbol into the database.

+5
source share
6 answers

There is nothing special about (the U + 20B9 New Rupee character), except that, being so new, it has almost zero font support. If you have a database connection that supports Unicode, you can save it as easily as any other character:

 INSERT INTO Currency (name, symbol) VALUES ('INR', '₹'); 

(You would like to use NVARCHAR for storage and N'₹' in SQL Server.)

If you don’t have a Unicode-safe connection (for example, you are using some kind of crap tool, such as the Windows console), you will have to work around this using, for example.

 VALUES ('INR', CHAR(226, 130, 185)) 

for a UTF-8 delimited column in MySQL or NCHAR(8377) for a Unicode column in SQL Server.

+5
source

Do not do this, but you can use NCHAR (integer_expression)

 insert into Currency (currencyName, currencysymbol) values ('Indian Rupee', NCHAR(8425) ) -- 8425 is 20B9 in decimal 
+1
source

Each character has a Unicode that is unique to the others; Indian Rupees Symbol has its own. since you can insert all other characters into your database, but most importantly, your currencysymbol field in the table should be NVARCHAR

When you insert this character, you should use its Unicode code, for example

  INSERT INTO Currency ([currencysymbol]) VALUES (N'⃰'); -- dont forget to use **N** before the symbol 

just make sure 20B9 is the code for your character

+1
source
 insert into currency values('india','rupee',N'रु'') 
+1
source

@Sanju As simple as pasting plain text, first of all you need to download the font from http://cdn.webrupee.com/WebRupee.V2.0.ttf . Then save this font file in a folder named "WebRupee" in order! how to copy this code or write your own code as document i, see

 <form method="post" action=""> <table><style> @font-face{font-family: 'WebRupee'; src: url('WebRupee/WebRupee.V2.0.ttf') format('truetype');font-weight: normal;font-style: normal;} .WebRupee{ color:#FF0000; font-family: 'WebRupee';} </style> <tr> <td><input type="text" name="rs" value="Rs."class="WebRupee" /></span> </td> </tr> <tr> <td><input type="submit" name="submit" value="submit" /> </td> </tr> </table> </form> <?php if($_POST['submit']){ $sql="insert into rs(inr)VALUES('$_POST[rs]')"; if(!mysql_query($sql,$con)) { die('Error:'.mysql_error()); } else{ echo "<script>alert('One Record Added !!!...')</script>"; mysql_close($con); }} ?> 

Hope this helps you.

+1
source

We used nvarchar colum for currencysymbol and insert NCHAR (8377):

 insert into Currency (currencyName, currencysymbol) values ('Indian Rupee', NCHAR(8377) ); 
+1
source

Source: https://habr.com/ru/post/958387/


All Articles