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

    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 -


    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 -

    @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)
    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. Advertisements

  2. 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, Oct 19, 2008
    1. Advertisements

  3. GTN170777

    GTN170777 Guest

    thank you

    GTN170777, Oct 23, 2008
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.