ASP problem

Swedie

Administrator
Personal
Gick med
6 Mar 2003
Ort
Stockholm-ish
Hoj
Yamaha R7 -24
Har fått lov att göra om lite saker i ASP-kod och har fastnat på ett problem.

Formuläret skickar inte in Å Ä Ö i databasen. Jag ANTAR att det måste konverteras om till   liknande taggar. Så därför har jag gjort så här där den "gör om" texten.


function fieldReplace(item)
item = replace(item, "'", "''")
item = replace(item, "%", "%")
item = replace(item, vbcrlf, "<br>")
item = replace(item, "å", "å")
item = replace(item, "Å", "Å")
item = replace(item, "ä", "ä")
item = replace(item, "Ä", "&Äuml;")
item = replace(item, "ö", "ö")
item = replace(item, "Ö", "Ö")
fieldReplace = item
end function

men han vill inte göra rätt ändå.

Är det ett känt fenomen?

Jag arbetar mot en .mdb-fil.
 

HanneZ

Avställd
Gick med
6 Apr 2005
Ort
Linnégatan
Hoj
R1 -05, XJ -97
Konstigt, vad händer på andra sidan? Försvinner hela ordet eller bara åäö-tecknet?
 

Swedie

Administrator
Personal
Gick med
6 Mar 2003
Ort
Stockholm-ish
Hoj
Yamaha R7 -24
bara å ä ö som inte följer med. Kan du asp?

här är den kod som postar in i databasen

<%
If Request.querystring("mode") = "postdb" then
strUserName = Session("userName")
strHeading = Request.Form("txtHeading")
strContent = Request.Form("FCKeditor1")
numStatus = Request.Form("numStatus")
strHeading = fieldReplace(strHeading)
strContent = fieldReplace(strContent)
numCategory = Request.Form("numCategory")
strSQL = "INSERT INTO tblnews (heading,content,postedby,status,[Timestamp],category)VALUES('" & strHeading & "','" & strContent & "','" & strUserName & "','" & numStatus & "', '" & date() & "', '" & numCategory & "')"
adoCon.Execute(strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listnews"
End If
%>

det är då strHeading = Request.Form("txtHeading") som behöver få å ä ö konverterat till koder.

skulle verkligen uppskatta hjälp. har försökt hitta andra nyhetsscript att använda, men de flesta är betalvarianter.

behöver ha ett system som klarar ta emot bilder... väl det enda. väldigt enkelt att använda.

ja här är hela koden...

<%
stringWrite.Encoding = System.Text.Encoding.GetEncoding("iso-8859-1")
%>

<%@ LANGUAGE="VBSCRIPT" %>
<%Response.Buffer=TRUE%>
<!--#include file='header.inc'-->
<!--#include file="md5.asp"-->
<!-- #INCLUDE file="FCKeditor/fckeditor.asp" -->
<% Dim oFCKeditor %>
<script language="javascript">
function invalid() {
if (document.User.txtPassword.value != document.User.txtPassword2.value) {
alert("Passwords don't match. Please re-enter.");
return false;
}
if (document.User.txtPassword.value =="") {
alert("Password is blank. Please re-enter.");
return false;
}
return true;
}
</script>
<table><tr><TD width="20%" valign=top><TABLE cellSpacing=3 cellPadding=3 border=0><TBODY><TR>
<!-- Menu Starts Here -->
<TD vAlign=top colSpan=2><BR> </TD></TR>
<td> </td>
<td><%= FormatDateTime(Date, 1) %>  <%= FormatDateTime(NOW, 3) %> </td>
<tr><td> </td><td> </td></tr>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=post">Post News </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=listnews">Manage News </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=addcat">Add Category </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=listcat">Manage Categories </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=view">View News </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=adduser">Add User </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=listusers">User Management </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="news.asp?mode=settings">Settings </A></TD></TR>
<TR vAlign=top>
<TD><IMG height=9 src="images/bullet1.jpg" width=9></TD>
<TD vAlign=center><A href="default.asp?mode=logout">Logout </A></TD></TR>
<!-- Menu Stops Here -->

</TR></TBODY></TABLE></TD><td width="80%" valign=top>

<!--#include file='dbconnection.inc'-->
<%
If Session("userAdmin") = 0 or IsNull(Session("userAdmin")) = True then
Response.Redirect"default.asp"
End If

function fieldReplace(item)
item = replace(item, "'", "''")
item = replace(item, "%", "%")
item = replace(item, vbcrlf, "<br>")
fieldReplace = item
end function

If Request.querystring("mode") = "post" then
%>
<%
Set rsCategory = Server.CreateObject("ADODB.Recordset")
strCatSQL = "SELECT ID, Name FROM tblCategory"
rsCategory.Open strCatSQL, adoCon
%>
<form name='News' method='post' action='news.asp?mode=postdb'>
<table width="100%"><tr><td><b>Heading:</b></td></tr><tr><td><input type='text' name='txtHeading'></td></tr>
<tr><td><b>Status:</b></td></tr><tr><td><select name='numStatus' size='1'>
<option value='1'>Active</option>
<option value='0'>InActive</option>
</select></td></tr>
<tr><td><b>Category:</b></td></tr><tr><td><select name='numCategory' size='1'>
<%Do While NOT rsCategory.EOF%>
<option value=<%=rsCategory("ID")%>><%=rsCategory("Name")%></option>
<%rsCategory.MoveNext
Loop%>
</select></td></tr>
<tr><td><b>Content:</b></td></tr><tr><td>
<%
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "FCKeditor/"
oFCKeditor.Create "FCKeditor1"
%>
</td></tr>
<tr><td><input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>
</td></tr></table></form>
<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>
<%
Set rsCategory = Nothing
Set adoCon = Nothing
End If
%>
<%
If Request.querystring("mode") = "postdb" then
strUserName = Session("userName")
strHeading = Request.Form("txtHeading")
strContent = Request.Form("FCKeditor1")
numStatus = Request.Form("numStatus")
strHeading = fieldReplace(strHeading)
strContent = fieldReplace(strContent)
numCategory = Request.Form("numCategory")
strSQL = "INSERT INTO tblnews (heading,content,postedby,status,[Timestamp],category)VALUES('" & strHeading & "','" & strContent & "','" & strUserName & "','" & numStatus & "', '" & date() & "', '" & numCategory & "')"
adoCon.Execute(strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listnews"
End If
%>
<%
If Request.querystring("mode") = "listnews" then
Set rsNewsAdmin = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT heading, ID, Timestamp, postedby, status FROM tblnews ORDER BY ID"
rsNewsAdmin.Open strSQL, adoCon
%>
<%
Response.Write ("<table><tr><td><b><center>Heading</center></b></td><td><b><center>Delete News</center></b></td><td><b><center>Edit News</center></b></td><td><b><center>Date Posted</center></b></td><td><b><center>Posted By</center></b></td><td><b><center>Status</center></b></td><td><b><center>Comments</center></b></td></tr>")
Dim strBGColor
strBGColor = "#EEEEEE"

Do While NOT rsNewsAdmin.EOF
if strBGColor = "#EEEEEE" Then strBGColor = "#D7D7D7" Else strBGColor = "#EEEEEE" %>
<tr bgcolor="<%= Cstr(strBGColor) %>"><td><center>
<%
Response.Write (rsNewsAdmin("heading"))
Response.Write ("</center></td><td><center><a href=news.asp?mode=delete&ID=")
Response.Write (rsNewsAdmin("ID"))
Response.Write (">")
Response.Write ("<img src='images/cancel.gif' border='0' Alt='Delete News'>")
Response.Write ("</a></center></td><td><center><a href=news.asp?mode=edit&ID=")
Response.Write (rsNewsAdmin("ID"))
Response.Write ("><img src='images/editnews.jpg' border='0' Alt='Edit News'></a></center></td>")
Response.Write ("<td><center>")
Response.Write (rsNewsAdmin("Timestamp"))
Response.Write ("</center></td>")
Response.Write ("<td><center>")
Response.Write (rsNewsAdmin("postedby"))
Response.Write ("</td></center>")
Response.Write ("<td><center>")
If rsNewsAdmin("status") = 1 then
Response.Write ("Active")
Else
Response.Write ("InActive")
End If
Response.Write ("</td></center><td><center>") %>
<a href="javascript:void(0);" onClick="window.open('admincomments.asp?newsID=<%=rsNewsAdmin("ID")%>','Comments','scrollbars=YES,width=450,height=450')">Comments</a>
<%
Response.Write ("</center></td></tr>")
rsNewsAdmin.MoveNext
Loop
Response.Write ("</table>")
Set rsNewsAdmin = Nothing
Set adoCon = Nothing

End If

%>
<%
If Request.querystring("mode") = "edit" then
strID = Clng(request.querystring("ID"))
Set rsEditNews = Server.CreateObject("ADODB.Recordset")
strEditSQL = "SELECT heading, content, status, category FROM tblnews WHERE ID= " & strID
rsEditNews.Open strEditSQL, adoCon
Set rsCategory = Server.CreateObject("ADODB.Recordset")
strCatSQL = "SELECT ID, Name FROM tblCategory"
rsCategory.Open strCatSQL, adoCon
%>

<form name='News' method='post' action='news.asp?mode=updatedb'>
<table width="100%"><tr><td><b>Heading:</b></td></tr><tr><td><input type='text' name='txtHeading' value='<%=rsEditNews("heading")%>'></td></tr>
<tr><td><b>Status:</b></td></tr><tr><td><select name='numStatus' size='1'>
<% if rsEditNews("status") = 1 Then%>
<option value='1' Selected>Active</option>
<option value='0'>InActive</option>
<%Else%>
<option value='1'>Active</option>
<option value='0' Selected>InActive</option>
<%end if%>
</select></td></tr>
<tr><td><b>Category:</b></td></tr><tr><td><select name='numCategory' size='1'>
<%Do While NOT rsCategory.EOF%>
<% If rsEditNews("category") = rsCategory("ID") Then%>
<option value=<%=rsCategory("ID")%> Selected><%=rsCategory("Name")%></option>
<%Else%>
<option value=<%=rsCategory("ID")%>><%=rsCategory("Name")%></option>
<%end if%>
<%rsCategory.MoveNext
Loop%>
</select></td></tr>
<tr><td><b>Content:</b></td></tr><tr><td>
<%
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "FCKeditor/"
oFCKeditor.Value = "" & rsEditNews("content") & ""
oFCKeditor.Create "FCKeditor1"
%>
</td></tr>
<input type='hidden' name='txtID' value='<%=strID%>'><tr><td><input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>
</td></tr></table></form>
<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>
<%
Set adoCon = Nothing
Set rsEditNews = Nothing
Set rsCategory = Nothing
End If
%>
 

HanneZ

Avställd
Gick med
6 Apr 2005
Ort
Linnégatan
Hoj
R1 -05, XJ -97
Nej har inte jobbat direkt mkt med asp.

Finns det inget alternativt sätt att hämta form-datan istället för Request.Form ?
 

Swedie

Administrator
Personal
Gick med
6 Mar 2003
Ort
Stockholm-ish
Hoj
Yamaha R7 -24
<%
If Request.querystring("mode") = "updatedb" then
strUserName = Session("userName")
strHeading = Request.Form("txtHeading")
strContent = Request.Form("FCKeditor1")
strID = Clng(Request.Form("txtID"))
numStatus = Request.Form("numStatus")
strHeading = fieldReplace(strHeading)
strContent = fieldReplace(strContent)
numCategory = Request.Form("numCategory")
strSQL = "UPDATE tblnews SET tblnews.heading='" & strHeading & "',tblnews.content='" & strContent & "',tblnews.postedby='" & strUserName & "', tblnews.status='" & numStatus & "',tblnews.Timestamp='" & date() & "', tblnews.category='" & numCategory &"' WHERE ID =" & strID
adoCon.Execute(strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listnews"
End If
%>
<%
If Request.querystring("mode") = "view" then
userAdmin = Session("userAdmin")
Set rsSettings = Server.CreateObject("ADODB.Recordset")
strSettingsSQL = "SELECT shownum,contentbgcolor,infobgcolor,infotextcolor,bordercolor,headbgcolor FROM tblsettings"
rsSettings.Open strSettingsSQL, adoCon
Set rsViewNews = Server.CreateObject("ADODB.Recordset")
strViewSQL = "SELECT TOP " & rsSettings("shownum") & " heading, [ID], [Timestamp], postedby, content FROM tblnews WHERE status = 1 ORDER BY [ID] DESC"
rsViewNews.Open strViewSQL, adoCon
%>
<%
Do While NOT rsViewNews.EOF
%>
<center><table border='1' width='90%' bordercolor=<%=rsSettings("bordercolor")%> style='border-collapse:collapse;'><tr><td width='100%' colspan='2' bgColor=<%=rsSettings("headbgcolor")%> style='font-family:verdana;font-weight:bold;font-size:8pt;'><img border='0' src='images/postin.gif'>
<%Response.Write (rsViewNews("heading"))%>
</td></tr><tr><td width='100%' colspan='2' style='font-family:verdana;font-size:8pt;' bgColor=<%=rsSettings("contentbgcolor")%>>
<%Response.Write (rsViewNews("content"))%>
</td></tr><tr><td width='50%' style='font-family:verdana;font-size:7pt;' bgColor=<%=rsSettings("infobgcolor")%>><font color=<%=rsSettings("infotextcolor")%>>
<%Response.Write (rsViewNews("timestamp"))%>
</font></td><td width='50%' style='font-family:verdana;font-size:7pt;' align='right' bgColor=<%=rsSettings("infobgcolor")%>><font color=<%=rsSettings("infotextcolor")%>>Posted by  
<%Response.Write (rsViewNews("postedby"))%>
  <img src='images/user.gif'></font></td></tr></table></center><p>
<%
rsViewNews.MoveNext
Loop
Set rsViewNews = Nothing
Set rsSettings = Nothing
Set adoCon = Nothing
End If
%>
<%
If Request.querystring("mode") = "add" then
strUserName = Replace(Request.Form("txtUserName"), "'", "''")
strPassword = Replace(Request.Form("txtPassword"), "'", "''")
strEmail = Request.Form("txtEmail")
strEPassword = md5(strPassword)
strUserName = fieldReplace(strUserName)
strSQL = "INSERT INTO tblusers ([username],[password],[Timestamp],email) VALUES('" & strUserName & "', '" & strEPassword & "', '" & date() & "', '" & strEmail & "')"
strSQLCheck = "SELECT username from tblusers where username = '" & strUserName & "'"
Set rsAdminCheck = adoCon.Execute(strSQLCheck)
If Not rsAdminCheck.EOF then
Response.Redirect"news.asp?mode=addusertaken"
Set rsAdminCheck = Nothing
Set adoCon = Nothing
End If
Response.Write strSQL
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listusers"
End If
%>
<%
If Request.querystring("mode") = "adduser" then
%>
<%
Response.Write ("<form name='User' method='post' action='news.asp?mode=add' onSubmit='return invalid();'>")
Response.Write ("<br>")
Response.Write ("<table><tr><td><b>UserName:</b>  </td><td><input type='text' name='txtUserName' value='UserName'></td></tr>")
Response.Write ("<tr><td><b>Password:</b>  </td><td><input type='password' name='txtPassword'</td></tr>")
Response.Write ("<tr><td><b>Confirm Password:</b>  </td><td><input type='password' name='txtPassword2'</td></tr>")
Response.Write ("<tr><td><b>Email Address:</b>  </td><td><input type='text' name='txtEmail'</td></tr>")
Response.Write ("<tr><td><input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</td></tr></table></form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
End If
%>
<%
If Request.querystring("mode") = "addusertaken" then
%>
<%
Response.Write ("<font color='red'>Username is already in use.</font><br><br>")
Response.Write ("<form name='User' method='post' action='news.asp?mode=add' onSubmit='return invalid();'>")
Response.Write ("<br>")
Response.Write ("<table><tr><td><b>UserName:</b>  </td><td><input type='text' name='txtUserName' value='UserName'></td></tr>")
Response.Write ("<tr><td><b>Password:</b>  </td><td><input type='password' name='txtPassword'</td></tr>")
Response.Write ("<tr><td><b>Confirm Password:</b>  </td><td><input type='password' name='txtPassword2'</td></tr>")
Response.Write ("<tr><td><input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</td></tr></table></form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
End If
%>
<%
If Request.querystring("mode") = "listusers" then
Set rsUserAdmin = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT username, ID FROM tblusers ORDER BY username"
rsUserAdmin.Open strSQL, adoCon
%>
<%
Response.Write ("<table><tr><td><b><center>UserName</center></b></td><td><b><center>Delete User</center></b></td><td><b><center>Change Password</center></b></td></tr>")
strBGColor = "#EEEEEE"

Do While NOT rsUserAdmin.EOF
if strBGColor = "#EEEEEE" Then strBGColor = "#D7D7D7" Else strBGColor = "#EEEEEE" %>
<tr bgcolor="<%= Cstr(strBGColor) %>"><td><center>
<%
Response.Write (rsUserAdmin("username"))
Response.Write ("</center></td><td><center><a href=news.asp?mode=deleteuser&ID=")
Response.Write (rsUserAdmin("ID"))
Response.Write ("><img src='images/cancel.gif' border='0' Alt='Delete User'></a></center></td>")
Response.Write ("<td><center><a href=news.asp?mode=change&ID=")
Response.Write (rsUserAdmin("ID"))
Response.Write ("><img src='images/security.gif' border='0' Alt='Change Password'></a></center></td></tr>")
rsUserAdmin.MoveNext
Loop
Response.Write ("</table>")
Set rsUSerAdmin = Nothing
Set adoCon = Nothing

End If
%>
<%
If Request.querystring("mode") = "delete" then
numID = Clng(Request.querystring("ID"))
strSQL = "DELETE FROM tblnews WHERE ID =" & numID
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listnews"
End If

If Request.querystring("mode") = "deleteuser" then
userID = Clng(Request.querystring("ID"))
strSQL = "DELETE FROM tblusers WHERE ID =" & userID
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listusers"
End If
%>
<%
If Request.querystring("mode") = "change" then
%>
<%
userID = Request.querystring("ID")
Response.Write ("<form name='User' method='post' action='news.asp?mode=changepassword' onSubmit='return invalid();'>")
Response.Write ("<br><b>Change Password</b><br><br>")
Response.Write ("<input type='Password' name='txtPassword'><br>")
Response.Write ("<input type='Password' name='txtPassword2'><br>")
Response.Write ("<input type=hidden value='" & userID & "' name='txtID'><br><br><br>")
Response.Write ("<input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")
End If
%>
<%
If Request.querystring("mode") = "changepassword" then
strUserID = Clng(Request.Form("txtID"))
strPassword = Replace(Request.Form("txtPassword"), "'", "''")
strEPassword = md5(strPassword)
strSQL = "UPDATE tblusers SET tblusers.password='" & strEPassword & "' WHERE ID =" & strUserID
adoCon.execute (strSQL)
Set adoCon = Nothing
Response.Redirect"news.asp?mode=listusers"
End If
%>
<%
If Request.querystring("mode") = "settings" then
%>

<script language=JavaScript src="colorpicker/picker.js" ></script>
<%
Set rsSettings = Server.CreateObject("ADODB.Recordset")

strSettingsSQL = "SELECT shownum,contentbgcolor,infobgcolor,infotextcolor,bordercolor,headbgcolor,sitetitle,sitelink,sitedesc,siteemail,emailserver,comments,tellafriend FROM tblsettings"

rsSettings.Open strSettingsSQL, adoCon

Response.Write ("<form name='Settings' method='post' action='news.asp?mode=settingsdb'>")
Response.Write ("<b>News Display Settings</b><br><br>")
Response.Write ("<table><tr><td># of News Entries to Show</td>")
Response.Write ("<td><select name='txtShowNum' size='1'>")
count = 0
Do While count < 100
if rsSettings("shownum") = count then
Response.Write ("<option value=" & count & " SELECTED>" & count & "</option>")
else
Response.Write ("<option value=" & count & ">" & count & "</option>")
end if
count = count +1
Loop
Response.Write ("</td></tr>")
Response.Write ("<tr><td>Border Color</td><td><input type='text' name='txtBorderColor' value=")
Response.Write (rsSettings("bordercolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtBorderColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>Header Background Color</td><td><input type='text' name='txtHeaderBgColor' value=")
Response.Write (rsSettings("headbgcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtHeaderBgColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>Content Background Color</td><td><input type='text' name='txtContentBgColor' value=")
Response.Write (rsSettings("contentbgcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtContentBgColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>News Information Background Color</td><td><input type='text' name='txtInfoBgColor' value=")
Response.Write (rsSettings("infobgcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtInfoBgColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>News Information Color</td><td><input type='text' name='txtInfoTextColor' value=")
Response.Write (rsSettings("infotextcolor"))
Response.Write ("> <a href='javascript:TCP.popup(document.Settings.txtInfoTextColor,1)'><img src='colorpicker/img/sel.gif' border='0' alt='Pick Color'></a></td></tr>")
Response.Write ("<tr><td>Site Install Link</td><td><input type='text' name='txtLink' value=")
Response.Write (rsSettings("sitelink"))
Response.Write ("></td></tr>")
Response.Write ("<tr><td>RSS Title</td><td><input type='text' name='txtTitle' value='")
Response.Write (rsSettings("sitetitle"))
Response.Write ("'></td></tr>")
Response.Write ("<tr><td>RSS Description</td><td><textarea name='txtDesc' cols='40' rows='6'>")
Response.Write (rsSettings("sitedesc"))
Response.Write ("</textarea></td></tr>")
Response.Write ("<tr><td>Site Email Address</td><td><input type='text' name='txtEmailAdd' value=")
Response.Write (rsSettings("siteemail"))
Response.Write ("></td></tr>")
Response.Write ("<tr><td>Email Server</td><td><input type='text' name='txtEmailServer' value=")
Response.Write (rsSettings("emailserver"))
Response.Write ("></td></tr>")
Response.Write ("<tr><td>Allow Users to add comments</td><td>")
If rsSettings("comments") = 1 then
Response.Write ("<input type='radio' name='numComments' value='1' checked> On   <input type='radio' name='numComments' value='0' > Off</td></tr>")
Else
Response.Write ("<input type='radio' name='numComments' value='1' > On   <input type='radio' name='numComments' value='0' checked> Off </td></tr>")
End If
Response.Write ("<tr><td>Allow Users to Tell a Friend</td><td>")
If rsSettings("tellafriend") = 1 then
Response.Write ("<input type='radio' name='numTellAFriend' value='1' checked> On   <input type='radio' name='numTellAFriend' value='0'> Off </td></tr>")
Else
Response.Write ("<input type='radio' name='numTellAFriend' value='1'>On   <input type='radio' name='numTellAFriend' value='0' checked> Off </td></tr>")
End If
Response.Write ("</table>")
Response.Write ("<input type='image' src='images/submit.jpg' name='Submit' value='Enter' alt='Enter'>")
Response.Write ("</form>")
Response.Write ("<FORM><INPUT type=image src=images/back.gif value='Back' onClick='parent.history.back(); return false;'></FORM>")

Set rsSettings = Nothing
Set adoCon = Nothing
End If
%>
<%
If Request.querystring("mode") = "settingsdb" then
Set rsSettings = Server.CreateObject("ADODB.Recordset")

strShowNum = Request.Form("txtShowNum")
strHeaderBgColor = Request.Form("txtHeaderBgColor")
strContentBgColor = Request.Form("txtContentBgColor")
strBorderColor = Request.Form("txtBorderColor")
strInfoBgColor = Request.Form("txtInfoBgColor")
strInfoTextColor = Request.Form("txtInfoTextColor")
strTitle = fieldReplace(Request.Form("txtTitle"))
strLink = Request.Form("txtLink")
strDesc = fieldReplace(Request.Form("txtDesc"))
strEmailAdd = Request.Form("txtEmailAdd")
strEmailServer = Request.Form("txtEmailServer")
CommentsNum = Request.Form("numComments")
TellAFriendNum = Request.Form("numTellAFriend")

strSQL = "UPDATE tblsettings SET tblsettings.shownum='" & strShowNum & "', tblsettings.headbgcolor='" & strHeaderBgColor & "',tblsettings.contentbgcolor='" & strContentBgColor & "',tblsettings.bordercolor='" & strBorderColor & "',tblsettings.infobgcolor='" & strInfoBgColor & "',tblsettings.infotextcolor='" & strInfoTextColor & "', tblsettings.sitetitle='" & strTitle & "', tblsettings.sitelink='" & strLink & "', tblsettings.sitedesc='" & strDesc & "', tblsettings.siteemail='" & strEmailAdd & "', tblsettings.emailserver='" & strEmailServer & "', tblsettings.comments='" & CommentsNum & "', tblsettings.tellafriend='" & TellAFriendNum & "'"
rsSettings.Open strSQL, adoCon

Set rsSettings = Nothing
Set adoCon = Nothing
Response.Redirect"news.asp?mode=settings"

End If

........ resten är bara "katalogsaker" som har samma problem. de tar inte med å ä ö heller.
 

NSR_Martin

Vill man så kan man.
Gick med
10 Mar 2003
Ort
Jönköping
Hoj
KTM 660 -04
För ett gäng år sedan va jag lite småbra på asp, men det mesta är bortglömt nu tyvärr.
Jag har dock inget minne av att det va några problem med ÅÄÖ, det funkade likabra som alla andra bokstäver vad jag minns.
Kan det inte ha nånting med mjukvaran på serven att göra? Att den pånåttsätt måste uppdateras så att den klararar av ÅÄÖ...?

Jag vet inte, va väll inte till så mycket hjälp, men jag minns somsagt inte att det va några problem med ÅÄÖ, så nått sånt tror jag det borde va... Någon som kan asp lite bättre får nog komma och rädda upp situationen helt enkelt :tummenupp
 

HanneZ

Avställd
Gick med
6 Apr 2005
Ort
Linnégatan
Hoj
R1 -05, XJ -97
Vad händer om du provat att skriva ut det som Request.Form returnerar? Tecknet kanske följer med men att inte databasen vill ta emot det. Spånar lite bara...
 

MDM

Livet är hårt.
Gick med
19 Oct 2005
Ort
örebro
Hoj
cbr -00
Följer stora Å Ä Ö med?
Det räcker inte att byta encoding till tex "rtf-8"?
har inte använt asp på .. ett tag..
 
Last edited:

Swedie

Administrator
Personal
Gick med
6 Mar 2003
Ort
Stockholm-ish
Hoj
Yamaha R7 -24
det är endast i Heading som det blir så.
i övrigt används en WYSIWYG editor... där funkar å ä ö.

Ingen skillnad på små eller stora bokstävler (å ä ö).

I databasen är det som syns i WYSIWYG/story fältet omgjort till koder istället för tecknena å ä ö.
 

korvgubbe

Ny medlem
Gick med
13 May 2003
Ort
Sthlm
Hoj
Versys -08
Swedie skrev:
2046360 det är endast i Heading som det blir så.

Det är inte så att du missat sätta default charset för databasen. För har du missat det kan du vara tvungen att sätta det på varje fält i dina tabeller. Jag gjorde den tabben tidigare och fick då gå in i varenda tabell och varenda kolumn och ange att även den skulle vara ISO8859_1...(iallafall där jag skulle lagra strängar)
 
Last edited:

MDM

Livet är hårt.
Gick med
19 Oct 2005
Ort
örebro
Hoj
cbr -00
korvgubbe skrev:
2046393 Det är inte så att du missat sätta default charset för databasen. För har du missat det kan du vara tvungen att sätta det på varje fält i dina tabeller. Jag gjorde den tabben tidigare och fick då gå in i varenda tabell och varenda kolumn och ange att även den skulle vara ISO8859_1...(iallafall där jag skulle lagra strängar)
Sånt misstag man bara gör en gång :tungan
 

korvgubbe

Ny medlem
Gick med
13 May 2003
Ort
Sthlm
Hoj
Versys -08
MDM skrev:
2046399 Sånt misstag man bara gör en gång :tungan

oh ja... särskillt i en databas med 150 tabeller! :huvet

Swedie skrev:
2046405 ja inte vet jag. för jag vet inte hur man gör. Jag har inte MS Access installerat

här är programmet.

www.sporthoj.com/stuff/aspnews.zip
ladda hem o kolla .mdb filen där. o allt annat oxå

Testa att lägga in följande överst på sidan:
Code:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
Gick med
4 Apr 2004
Ort
Stockholm
Hoj
Kawasaki ZR600E
Inga felmeddelanden? (aktiverat dessa i webläsaren?) Det enda som du märker av är att åäö samt ÅÄÖ inte följer med i posten till databasen?

En bra plats för hjälp är www.aspsidan.nu

Mvh
Johan
 
Nyheter
Honda NT1100 med semi-aktiv fjädring

Honda har uppdaterat NT1100...

Yamaha Tracer 9 uppdateras

Sporttouring-modellerna TRA...

EICMA 2024: Ducati

Som väntat släppte de itali...

Royal Enfield lanserar nytt varumärke för eldrivna motorcyklar

Royal Enfield har tagit ste...

Honda ICE Concept

2025 Honda ICE Concept bike...

EICMA 2024

Nu lämnar vi Milano-mässan ...

EICMA 2024: KTM

Vi får dra oss tillbaka til...

SMC kräver omedelbar reform av 5-5-regeln

Sveriges MotorCyklister (SM...

Yamaha Tracer 9-modellerna uppdateras

Yamahas Sports Touring-mode...

Svenska Roam utnämnt till en av världens 100 viktigaste ”impact”-bolag

Roam, det kenyanska elmotor...

Top