473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3088

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: reneecccwest | last post by:
Hello, can anybody share the code for a word counter for the textarea user input? what if max characters are 256? thanks
1
by: Lenny Linux | last post by:
Is there any javascript or html example code I can look at to have an input button paste windows clipboard data into a textarea. I'm just a slow in the head tired old man seeking answers to how....
7
by: Bani | last post by:
Is it possible to get browser-menu events (IE) into Javascript? I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v). Now the users would like to trigger it also from the browser...
5
by: spectre | last post by:
Hi, I need to copy/paste texts form word, notepad... to an html textarea to store it into a database. With the <pre>tag, and a text with long lines, the text displayed in the textarea needs...
0
by: Chris | last post by:
I am trying to do a mail merge from Access 2000/2002 through VBA to a Word document. It all works fine on all Windows 2000 machines (regardless of if it is Office 2000 or 2002) but it doesn't work...
1
by: trihanhcie | last post by:
Hi I have several textarea in the same page. I would like to count the words in each textarea without any interaction with each other. Here's the code I used for the count : <script...
13
by: halbenca | last post by:
Is this possible with Javascript in anyway? :)
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
5
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, It's been a while, I've got a small problem that I could do with your expertise on. As you know (I Think) I build websites for recruitment agencies, part of the website includes a job...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.