Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Unicode problem

Unicode problem

Scheduled Pinned Locked Moved Visual Basic
javascriptdatabasesysadminhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ybasha
    wrote on last edited by
    #1

    Hi there, i have a database which contain some junk character in some fields like for ex:"è" i need to replace this junk character into "è" the application where iam using this database is ASP page and need to have a solution where at one shot i can replace all this junk charac in my database fields there are around 7 different junk character in 5 fields and i have 500 records like this in my database i try to solve this problem with the javascript but i need a connection so that in one click i can loop thro all the fields and replace the character but cant do it here is the code snippet : sqlqry="" set rstest=server.CreateObject("ADODB.Recordset") sqlqry = "select Title, Description, Description_abtract, Dc_source, Rights_Rightsholder from Articles_production" rstest.Open sqlqry,conn,3,3 var str= sqlqry (str.replace(/è/gi,"è")) (str.replace(/é/gi,"é")) (str.replace(/’/gi,"’")) (str.replace(/“/gi,"“")) (str.replace(/”/gi,"”")) (str.replace(/ç/gi,"ç")) (str.replace(/ä/gi,"ä")) pls any solutions regards cyus

    G 1 Reply Last reply
    0
    • Y ybasha

      Hi there, i have a database which contain some junk character in some fields like for ex:"è" i need to replace this junk character into "è" the application where iam using this database is ASP page and need to have a solution where at one shot i can replace all this junk charac in my database fields there are around 7 different junk character in 5 fields and i have 500 records like this in my database i try to solve this problem with the javascript but i need a connection so that in one click i can loop thro all the fields and replace the character but cant do it here is the code snippet : sqlqry="" set rstest=server.CreateObject("ADODB.Recordset") sqlqry = "select Title, Description, Description_abtract, Dc_source, Rights_Rightsholder from Articles_production" rstest.Open sqlqry,conn,3,3 var str= sqlqry (str.replace(/è/gi,"è")) (str.replace(/é/gi,"é")) (str.replace(/’/gi,"’")) (str.replace(/“/gi,"“")) (str.replace(/”/gi,"”")) (str.replace(/ç/gi,"ç")) (str.replace(/ä/gi,"ä")) pls any solutions regards cyus

      G Offline
      G Offline
      Gavin Jeffrey
      wrote on last edited by
      #2

      You could (should be able to depending on the database u r using?) do the entire thing at the database level, below is a mssql example - update Articles_production set Description = replace(Description,'junk character','replacement character'), Description_abtract = .... You may however have to run the update statement for each junk character.

      Y 1 Reply Last reply
      0
      • G Gavin Jeffrey

        You could (should be able to depending on the database u r using?) do the entire thing at the database level, below is a mssql example - update Articles_production set Description = replace(Description,'junk character','replacement character'), Description_abtract = .... You may however have to run the update statement for each junk character.

        Y Offline
        Y Offline
        ybasha
        wrote on last edited by
        #3

        Hi jeffrey, i try the above qury in my query Analyzer it show me error: argument data type ntext is invalid for argument 1 of replace function. To support unicode character i created datatype as ntext. :) Regards cyus

        G 1 Reply Last reply
        0
        • Y ybasha

          Hi jeffrey, i try the above qury in my query Analyzer it show me error: argument data type ntext is invalid for argument 1 of replace function. To support unicode character i created datatype as ntext. :) Regards cyus

          G Offline
          G Offline
          Gavin Jeffrey
          wrote on last edited by
          #4

          if you know that the data in the columns doesn't exceed a length of 8000 you could try something like - update Table1 set test1=replace(convert(varchar(8000),test1),'x','a'), test2=replace(convert(varchar(80000),test2),'x','a') Otherwise you might have to go the code route.

          Y 1 Reply Last reply
          0
          • G Gavin Jeffrey

            if you know that the data in the columns doesn't exceed a length of 8000 you could try something like - update Table1 set test1=replace(convert(varchar(8000),test1),'x','a'), test2=replace(convert(varchar(80000),test2),'x','a') Otherwise you might have to go the code route.

            Y Offline
            Y Offline
            ybasha
            wrote on last edited by
            #5

            hey Jeffery, i try this in my code but some problem in the updated stmt can u help me shoot wht the problem is the compiler thro me error The name Var1 does not exist in the class or namespace of the project.... here is the codesnippet string strsql; DataTable dt; SqlDataAdapter da; SqlConnection objConn = new SqlConnection("data source=yusuff;user id=sa;password=sa;initial catalog=Heritage"); dt = new DataTable(); strsql = "select * from Articles_production"; da = new SqlDataAdapter(strsql,objConn); da.Fill(dt); if(dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) //ervy loop for (int i=0;i

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups