简体   繁体   English

如何在数据库中插入印度卢比符号(Oracle 10g,MySql 5.0和Sql Server 2008)?

[英]How to insert Indian Rupees Symbol in Database (Oracle 10g, MySql 5.0 and Sql Server 2008)?

How to insert Indian Rupees Symbol in Database (Oracle 10g, MySql 5.0 and Sql Server 2008)? 如何在数据库中插入印度卢比符号(Oracle 10g,MySql 5.0和Sql Server 2008)?

Actually i had one Table "Currency" , in which 2 field is like "currencyName" and "currencysymbol", so how would i insert new rupees symbol in databse. 实际上我有一个表“货币”,其中2个字段就像“currencyName”和“currencysymbol”,所以我将如何在数据库中插入新的卢比符号。

There's nothing special about (U+20B9 New Rupee symbol), except that, being so new, there is almost zero font support for it. 有没有什么特别的 (U + 20B9新卢比符号),所不同的是,这么新,有一个几乎为零字体支持。 If you've got a database connection that supports Unicode, you can store it just as easily as any other character: 如果您有一个支持Unicode的数据库连接,您可以像任何其他字符一样轻松地存储它:

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

(You would want to use NVARCHAR for storage and N'₹' in SQL Server.) (您可能希望在SQL Server中使用NVARCHAR进行存储并使用N'₹' 。)

If you haven't got a Unicode-safe connection (for example you're using some crap tool like the Windows console) you would have to work around that using eg. 如果您没有安全的Unicode连接(例如,您正在使用某些垃圾工具,如Windows控制台),则必须使用例如。

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

for a UTF-8-collated column in MySQL, or NCHAR(8377) for a Unicode column in SQL Server. 对于MySQL中的UTF-8整理列,或对于SQL Server中的Unicode列,使用NCHAR(8377)

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

@Sanju Its so simple as to insert normal text, first of all you need to download a font from http://cdn.webrupee.com/WebRupee.V2.0.ttf . @Sanju简单到插入普通文本,首先需要从http://cdn.webrupee.com/WebRupee.V2.0.ttf下载字体。 Than keep this font file in a folder named 'WebRupee' ok! 将此字体文件保存在名为“WebRupee”的文件夹中即可! than copy this code or write your own code as i deed, 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 it will help you. 希望它会对你有所帮助。

We have used nvarchar colum for currencysymbol and insert NCHAR(8377) : 我们使用nvarchar colum for currencysymbol并插入NCHAR(8377):

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

Not ever done this but can use use NCHAR (integer_expression ) 从来没有这样做但可以使用NCHAR(integer_expression)

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

Each character has a Unicode that unique it from others, Indian Rupees Symbol has it own. 每个角色都有一个与其他角色独特的Unicode, Indian Rupees Symbol拥有它。 so as every other characters you can insert it in yourdatabase, but the most important point is that your currencysymbol field in table should be NVARCHAR 所以每个其他字符都可以插入到数据库中,但最重要的一点是表中的currencysymbol字段应该是NVARCHAR

When you are inserting this symbol you have to use its Unicode code like 插入此符号时,必须使用其Unicode代码

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

just make sure that 20B9 is the code for your character 只需确保20B9是你角色的代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM