簡體   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)?

如何在數據庫中插入印度盧比符號(Oracle 10g,MySql 5.0和Sql Server 2008)?

實際上我有一個表“貨幣”,其中2個字段就像“currencyName”和“currencysymbol”,所以我將如何在數據庫中插入新的盧比符號。

有沒有什么特別的 (U + 20B9新盧比符號),所不同的是,這么新,有一個幾乎為零字體支持。 如果您有一個支持Unicode的數據庫連接,您可以像任何其他字符一樣輕松地存儲它:

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

(您可能希望在SQL Server中使用NVARCHAR進行存儲並使用N'₹' 。)

如果您沒有安全的Unicode連接(例如,您正在使用某些垃圾工具,如Windows控制台),則必須使用例如。

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

對於MySQL中的UTF-8整理列,或對於SQL Server中的Unicode列,使用NCHAR(8377)

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

@Sanju簡單到插入普通文本,首先需要從http://cdn.webrupee.com/WebRupee.V2.0.ttf下載字體。 將此字體文件保存在名為“WebRupee”的文件夾中即可! 比復制此代碼或編寫自己的代碼作為我的行為,請參閱

<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);
        }}

         ?>

希望它會對你有所幫助。

我們使用nvarchar colum for currencysymbol並插入NCHAR(8377):

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

從來沒有這樣做但可以使用NCHAR(integer_expression)

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

每個角色都有一個與其他角色獨特的Unicode, Indian Rupees Symbol擁有它。 所以每個其他字符都可以插入到數據庫中,但最重要的一點是表中的currencysymbol字段應該是NVARCHAR

插入此符號時,必須使用其Unicode代碼

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

只需確保20B9是你角色的代碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM