469,331 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

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

Oct 19 '08 #1
2 2998

"GTN170777" <GT*******@discussions.microsoft.comwrote in message
news:48**********************************@microsof t.com...
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

Oct 19 '08 #2
thank you

"Anthony Jones" wrote:
>
"GTN170777" <GT*******@discussions.microsoft.comwrote in message
news:48**********************************@microsof t.com...
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

Oct 23 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by reneecccwest | last post: by
1 post views Thread by Lenny Linux | last post: by
5 posts views Thread by spectre | last post: by
reply views Thread by Chris | last post: by
1 post views Thread by trihanhcie | last post: by
13 posts views Thread by halbenca | last post: by
5 posts views Thread by =?Utf-8?B?R1ROMTcwNzc3?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.