problem with paste from word into textarea asp MS SQL 2000

Discussion in 'ASP General' started by GTN170777, Oct 19, 2008.

  1. GTN170777

    GTN170777 Guest

    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
    GTN170777, Oct 19, 2008
    #1
    1. Advertising

  2. "GTN170777" <> wrote in message
    news:...
    > 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
    Anthony Jones, Oct 19, 2008
    #2
    1. Advertising

  3. GTN170777

    GTN170777 Guest

    thank you

    "Anthony Jones" wrote:

    >
    > "GTN170777" <> wrote in message
    > news:...
    > > 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
    >
    >
    GTN170777, Oct 23, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Z2F1cmF2?=

    Uploading Data From MS Acess 2000 ti SQL server 2000

    =?Utf-8?B?Z2F1cmF2?=, Jan 9, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    783
    Mary Chipman [MSFT]
    Jan 9, 2006
  2. Replies:
    2
    Views:
    1,009
  3. C Did
    Replies:
    3
    Views:
    3,922
    Chris Lithgow
    Jun 20, 2006
  4. Steve
    Replies:
    6
    Views:
    616
    Eric Layman
    Mar 3, 2007
  5. Denis

    Access 2000 or SQL Server 2000

    Denis, Jan 25, 2004, in forum: ASP General
    Replies:
    1
    Views:
    178
    Nicole Calinoiu
    Jan 25, 2004
Loading...

Share This Page