Accented characters retrieved by ASP page as chara

Results 1 to 2 of 2

Thread: Accented characters retrieved by ASP page as chara

  1. #1
    Join Date
    Dec 1969

    Default Accented characters retrieved by ASP page as chara

    &nbsp;<BR>The data is stored in a SQL Server 7 database. <BR><BR>If I view the data using Access 2000, I can see all the french accents. <BR><BR>However, if I try to extract the data using an ASP page, every occurence of any french character is replaced with the square character - Asc(letter) on the french character always returns character number 26. <BR><BR>I realize that I have to convert the french character to it&#039;s HTML equivalent, but the data being returned in the recordset is littered with character number 26, which is basically a garbage character. <BR><BR>I tried putting the following lines at the beginning of my page, but that didn&#039;t work: <BR>&#060;%@ Language=VBScript CodePage=65001%&#062; <BR>&#060;%Session.CodePage = 65001%&#062; <BR><BR>Also tried putting the following line in the &#060;HEAD&#062; of the document, but that also didn&#039;t work: <BR>&#060;META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8"&#062; <BR><BR>So here&#039;s my question... if it displays correctly in Access, why can&#039;t I get my ASP page to display it correctly? <BR><BR>If I do this: <BR><BR>&#060;%=Chr(122)%&#062; <BR><BR>I get the correct French character. So I know the actual HTML page is correctly set up. <BR><BR>My HTML page does correctly display french accents if I type them in directly (Ex: &cirqu;) <BR><BR>If I do this: <BR><BR>&#060;%=Chr(122)%&#062; <BR><BR>The correct French character displays on the page. So I know the actual HTML page is correctly set up. <BR><BR>This leads me to believe that this is a Data Access problem.<BR><BR>If I do this:<BR>&#060;%=RS("aField")%&#062;<BR><BR>The output looks like this...<BR><BR>Dtails<BR><BR>Where the  is actually a French accented character.<BR><BR>If I do a Chr() on the  character, no matter what accented character is being Chr()&#039;ed, the result is always 26.<BR><BR><BR>Why is this happening? What am I missing? <BR>

  2. #2
    Join Date
    Dec 1969

    Default That one *is* weird!

    I&#039;m really happy to see somebody who knows how to debug! You saved me *tons* of typing, telling you what to try (that wouldn&#039;t have worked).<BR><BR>I think your instinct about the Session.CodePage was the right thing to do, but I think you chose the wrong CodePage number.<BR><BR>Problem is, I think the *right* CodePage number is likely the default one! 1252 is supposed to be standard Western European.<BR><BR>Can I ask a question? Have you tried going the other way? Tried to insert a string containing CHR(122) into Access? And see what that appears as?<BR><BR>Or, maybe better even, do a <BR> "... WHERE FIELD = &#039;" & str & "&#039;"<BR>where you use CHR(122) in that "str" variable?<BR><BR>AHA! I just checked: Access has the ASC function, as well!<BR><BR>How about doing <BR> "SELECT Asc(afield) ..."<BR>and see what that gives you.<BR><BR>And one last thing: Try using ASCW(...) in VBScript and see if *that* gives you 122. <BR><BR>No, one more... <BR> &#060;%<BR> s = CHR( 122 )<BR> Response.Write s & ": " & Asc(s) & "&#060;P&#062;"<BR> %&#062;<BR><BR>Does that give you the desired character *and* display 122?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts