Database Code
  Home arrow Database Code arrow Saving multilingual text inside SQL Server...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM developerWorks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE CODE

Saving multilingual text inside SQL Server by M. Vadivel
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2002-09-17

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

     

    Saving multilingual text inside SQL Server

    Advantages:

    In most of the sites you would have seen the user downloading a type of font and installing it in their Windows ŕ fonts folder. The users will be able to see the characters of that particular language only after this downloading is done. But if you as the site developer save the Unicode text that represents a language inside a table and display that content in the web page then there is no need of user downloading the font. Isn’t this a great advantage? (For ex: If you are creating a web page in Chinese language then the user would be forced to download some font files which would be approx 6MB.)

    Disadvantage:

    If you like to offer multiple language support to users of your website, it is most important to use the Unicode character strings, nchar, nvarchar, and ntext (where n stands for “National”), for all character data but the sad part is that it would take more storage space than the character strings.

    A small example Web page 1

    Create an html page from where you can copy multilingual text from any site and paste it in a provision given in this page. Please note that I am not concentrating on any client side validations here. So it is your responsibility to add any client side validation according to your needs.

    <Html>
    <Head>
    <Meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <Title>Saving Multilingual character into database</Title>
    </Head> <Body>
    <h3 align="center">Copy multilingual text from any site and paste it inside this textbox before pressing the submit button</h3> <form name="frmInputDB" method="post" action="frmSaveandRetrieve.asp"> <table border=1 align="center"> <tr> <td>Enter your text here :</td> <td><input name="txtMultiLingual"></td></tr> <tr> <td colspan="2" align="center"> <input type=submit name="btnButton" value="Submit"> </td> </tr> </table> <p><p>* Please note that no validation has been done in this page. </form> </Body>
    </Html>

    Did you note the change in the meta tags charset property? Yes you need to specify “utf-8” as your charset so that Unicode characters would be allowed in that page. If you try skipping that line while creating any multilingual web page you would get an error while saving that page. The error would read something like this “Some Unicode characters in the file cannot be represented in the current code page and were replaced by default character…….”.

    Web page 2

    <Html>
    <Head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    </Head>
    <Body>
    <%
    Dim DBConn,strConnection,sql,
    strConnection="---Put your connection string here."
    Set DBConn = Server.CreateObject("Adodb.Connection")
    set Rs=server.CreateObject("ADODB.Recordset")  
    DBConn.Open(strConnection)
    Strdescription = Request.Form("txtMultiLingual")
    sql = "insert into UniTesting(description) values(N'" & Strdescription & "')"
    dbConn.Execute(sql)
    sql = "select id, [description] from UniTesting order by id"
    set Rs=dbConn.execute(sql)%>
    <table border=1>
    <tr>
    <td>Row Id</td>
    <td>Multi-Lingual Text</td>
    </tr>
    <%
    while not rs.EOFResponse.Write ("<tr><td>")Response.Write Rs("id") & "</td><td>" & Rs(1) & "</td><tr>"rs.MoveNextwend%></table></Body>
    </Html>

    If you try to insert data in some language, which isn’t the default language of the OS or SQL Server, then all the characters inserted into the database might be substituted. Since SQL Server 7.0 and 2000 support both Unicode and non-Unicode data types, they require you to use the "N" prefix in front of Unicode string literals (before the open quotes). Just remember: simply place that "N" prefix in front of the string literal you are using. This will allow your data to be inserted without being corrupted, and this would also be a faster process!

    A small DB structure

    CREATE TABLE UniTesting (id int IDENTITY (1, 1) NOT NULL , 
    description nchar (100) NULL)

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Database Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    Check out the new Jazz space on developerWorks

    <a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts.
    FREE! Go There Now!


    NEW! Cook up Web sites fast with CakePHP, Part 4: Use CakePHP&apos;s Session and Request Handler components

    CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP.
    FREE! Go There Now!


    NEW! Download IBM Data Studio V1.1

    Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z

    IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects.
    FREE! Go There Now!


    NEW! Rational Asset Manager eKit

    Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions.
    FREE! Go There Now!


    NEW! Rational Talks to You: Manage RUP-based CMMI initiatives

    Join this Rational Talks to You teleconference on December 4 at 1:00 pm ET to discuss how Rational Method Composer can help meet your compliance objectives. Get your questions answered!
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Tester for SOA Quality V7.0.1

    Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!


    NEW! Webcast: Striking the right balance between manual and automated testing

    Join this webcast to learn how IBM Rational's Functional Testing solution enables you to implement automation your way, at your pace, with your existing staff. In this webcast, you’ll learn how you can eliminate redundancy of manual test scripts, reduce errors, and increase test coverage through test automation. After this presentation you will understand how IBM Rational Functional Testing solution can streamline your manual testing and make test automation easily attainable.
    FREE! Go There Now!


    NEW! Whitepaper: Delivering SOA solutions: service lifecycle management

    The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    DATABASE CODE ARTICLES

    - Deployment of the MobiLink Synchronization M...
    - MobiLink Synchronization Wizard in SQL Anywh...
    - Finding Matching Records in Data Access Pages
    - Using the AccessDataSource Control in VS 2005
    - A Closer Look at ADO.NET: The Command Object
    - A Closer Look at ADO.NET: The Connection Obj...
    - Using ADO to Communicate with the Database, ...
    - Code Snippets: Counting Records
    - Constraints In Microsoft SQL Server 2000
    - Multilingual entries into a DB and to be dis...
    - Getting A List of Tables From SQL Server
    - SQL Server Database Creator - .NET Version
    - ADO Recordset Paging
    - Two combos, one textbox example
    - Discussion & Listserv Module by Mike Eck...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway