problem with paste from word into textarea asp MS SQL 2000 | | |
Hi there,
I'm hoping this is the place to submit this, as really I am looking to
resolve the issue before the data is sent to the database.
I have a website, with a textarea, that stores data in an nvarchar(4000)
field, the insert is done via a stored procedure. The data is sent as HTML
Encoded.
This works fine when data is manually entered, however if the user enters
the data by copying and pasting from Word, Notepad, PDF, etc the data is
entered ok, but then doesn't display properly.
The problem seems to be the use of the tab key in the associated program,
for instance -
The data from word looks like this -
"• To hold a Degree with a significant "
The data held on the database then looks like this -
"• To hold a Degree"
Please note the gap between ":" and "To" this doesn't appear to be a space
as it is to big.
The data that is then displayed is -
"•aU"
If i manually remove the gap I get the following -
"•To hold a Degree with a significant " with no gap
Obviously i can't manually do this for every entry, and i deally I still
want to keep the structure of the text, i.e paragraphs.
I think the problem is around ordered and unordered lists from Word etc, and
the tab space between the bullet and first letter, is there anyway to clear
both the un/ordered list and tab space before submitting the data?
I'm using MS SQL 2000
My stored procedure looks like this -
CREATE PROCEDURE NormalAdvert
@EmployeeId int,
@SiteID int,
@ClientId INT,
@JobTitle nvarchar(50),
@Description nvarchar(4000),
@Payrate nvarchar(50),
@location nvarchar(50),
@category nvarchar(50),
@employmenttype nvarchar(50),
@reference nvarchar(50),
@startdate nvarchar(50)
AS
Declare @NewID INT
INSERT INTO dbo.JBAdvert (JBASiteID, JBAEmployeeID, JBAClientID, JBATitle,
JBADescription, JBAPayRate, JBALocation, JBACategory, JBAEmplymentType,
JBAReference, JBAStartDate)
VALUES (@SiteID, @EmployeeId, @ClientId, @JobTitle, @Description, @Payrate,
@location, @category, @employmenttype, @reference, @startdate)
Thank you | | | | re: problem with paste from word into textarea asp MS SQL 2000
"GTN170777" <GTN170777@discussions.microsoft.comwrote in message
news:48DABC48-668C-40C3-AD7D-5944D867551D@microsoft.com... Quote:
Hi there,
>
I'm hoping this is the place to submit this, as really I am looking to
resolve the issue before the data is sent to the database.
>
I have a website, with a textarea, that stores data in an nvarchar(4000)
field, the insert is done via a stored procedure. The data is sent as HTML
Encoded.
>
This works fine when data is manually entered, however if the user enters
the data by copying and pasting from Word, Notepad, PDF, etc the data is
entered ok, but then doesn't display properly.
>
The problem seems to be the use of the tab key in the associated program,
for instance -
>
The data from word looks like this -
>
"• To hold a Degree with a significant "
>
The data held on the database then looks like this -
>
"• To hold a Degree"
Please note the gap between ":" and "To" this doesn't appear to be a space
as it is to big.
>
The data that is then displayed is -
>
"•aU"
>
If i manually remove the gap I get the following -
>
"•To hold a Degree with a significant " with no gap
>
Obviously i can't manually do this for every entry, and i deally I still
want to keep the structure of the text, i.e paragraphs.
>
I think the problem is around ordered and unordered lists from Word etc,
and
the tab space between the bullet and first letter, is there anyway to
clear
both the un/ordered list and tab space before submitting the data?
>
I'm using MS SQL 2000
>
My stored procedure looks like this -
>
CREATE PROCEDURE NormalAdvert
@EmployeeId int,
@SiteID int,
@ClientId INT,
@JobTitle nvarchar(50),
@Description nvarchar(4000),
@Payrate nvarchar(50),
@location nvarchar(50),
@category nvarchar(50),
@employmenttype nvarchar(50),
@reference nvarchar(50),
@startdate nvarchar(50)
AS
Declare @NewID INT
INSERT INTO dbo.JBAdvert (JBASiteID, JBAEmployeeID, JBAClientID, JBATitle,
JBADescription, JBAPayRate, JBALocation, JBACategory, JBAEmplymentType,
JBAReference, JBAStartDate)
VALUES (@SiteID, @EmployeeId, @ClientId, @JobTitle, @Description,
@Payrate,
@location, @category, @employmenttype, @reference, @startdate)
>
The SQL is not at fault here.
This will be an encoding mismatch between the source page where the form is
placed and the destination page that the data is posted to.
At a guess I would suggest that your form page specifies Response.CharSet =
"UTF-8" in which case the page that it posts to should be setting the
Response.CodePage = 65001 but it currently isn't. This would result in
UTF-8 encoding to accepted as if they were part of an ANSI codepage which
then get stored in the DB.
When you've corrected your receiving page you will need to repair the
corrupt data in the DB.
--
Anthony Jones - MVP ASP/ASP.NET | | | | re: problem with paste from word into textarea asp MS SQL 2000
thank you
"Anthony Jones" wrote: Quote:
>
"GTN170777" <GTN170777@discussions.microsoft.comwrote in message
news:48DABC48-668C-40C3-AD7D-5944D867551D@microsoft.com... Quote:
Hi there,
I'm hoping this is the place to submit this, as really I am looking to
resolve the issue before the data is sent to the database.
I have a website, with a textarea, that stores data in an nvarchar(4000)
field, the insert is done via a stored procedure. The data is sent as HTML
Encoded.
This works fine when data is manually entered, however if the user enters
the data by copying and pasting from Word, Notepad, PDF, etc the data is
entered ok, but then doesn't display properly.
The problem seems to be the use of the tab key in the associated program,
for instance -
The data from word looks like this -
"• To hold a Degree with a significant "
The data held on the database then looks like this -
"• To hold a Degree"
Please note the gap between ":" and "To" this doesn't appear to be a space
as it is to big.
The data that is then displayed is -
"•aU"
If i manually remove the gap I get the following -
"•To hold a Degree with a significant " with no gap
Obviously i can't manually do this for every entry, and i deally I still
want to keep the structure of the text, i.e paragraphs.
I think the problem is around ordered and unordered lists from Word etc,
and
the tab space between the bullet and first letter, is there anyway to
clear
both the un/ordered list and tab space before submitting the data?
I'm using MS SQL 2000
My stored procedure looks like this -
CREATE PROCEDURE NormalAdvert
@EmployeeId int,
@SiteID int,
@ClientId INT,
@JobTitle nvarchar(50),
@Description nvarchar(4000),
@Payrate nvarchar(50),
@location nvarchar(50),
@category nvarchar(50),
@employmenttype nvarchar(50),
@reference nvarchar(50),
@startdate nvarchar(50)
AS
Declare @NewID INT
INSERT INTO dbo.JBAdvert (JBASiteID, JBAEmployeeID, JBAClientID, JBATitle,
JBADescription, JBAPayRate, JBALocation, JBACategory, JBAEmplymentType,
JBAReference, JBAStartDate)
VALUES (@SiteID, @EmployeeId, @ClientId, @JobTitle, @Description,
@Payrate,
@location, @category, @employmenttype, @reference, @startdate)
>
The SQL is not at fault here.
>
This will be an encoding mismatch between the source page where the form is
placed and the destination page that the data is posted to.
>
At a guess I would suggest that your form page specifies Response.CharSet =
"UTF-8" in which case the page that it posts to should be setting the
Response.CodePage = 65001 but it currently isn't. This would result in
UTF-8 encoding to accepted as if they were part of an ANSI codepage which
then get stored in the DB.
>
When you've corrected your receiving page you will need to repair the
corrupt data in the DB.
>
>
--
Anthony Jones - MVP ASP/ASP.NET
>
>
|  | Similar ASP / Active Server Pages bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,467 network members.
|