Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan Evans 629 posts 1016 karma points
    Feb 02, 2010 @ 13:59
    Dan Evans
    0

    Length of dictionary item

    I'm using the Dictionary to store html formatted text which is being added as a label to a Contour form. The HTML is quite long (e.g. 8000+ characters. When i save the dictionary item I get this error:

     

     

    String or binary data would be truncated.
    The statement has been terminated.

    However the complete dictionary item has been saved correctly and is displayed on the page.

    The odd thing is that at some point after this (and I can't see why) the dictionary item vanishes. I am assuming that there is some Umbraco internal task that updates dictionary items?

    What is the length limit on a dictionary item? And how can I get round the disappearing item?

    Thanks

    Dan

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Feb 03, 2010 @ 13:10
    Tim
    0

    That looks like a SQL error, it normally pops up if submit data that's too long for a database field, e.g. 300 characters to text to a field that's set to varchar(255).

    I'm not that familiar with the inner workings of the dictionary, but the Dictionary table in the database uses GUIDs for keys, so it's possible the text is stored in the umbracoNode table, in which case the character limit is 255 characters for its text. That would account for the error you're getting. As for the disappearing dictionary item, the error suggests that your database isn't being updated, but Umbraco might still be updating its XML cache with the dictionary, which means it would be there until the cache was rebuilt, at which point it would vanish because it isn't in the database.

    I'm only guessing here though, as I'm at work, so can't poke around too much, but try adding a short distinctive word (like aardvaark) to the dictionary and see if it shows up in the umbracoNode table (the text will be in the 'text' column). If it does, then my guess is correct. Theoretically, changing the 'text' column in the database to ntext or nvarchar(MAX) might solve your problem, although it would depend on whether the SQL that updates the database uses a strongly typed sql parameter that's also set to nvarchar(255).

    Hope that helps/makes sense!

    :)

  • Per Ploug Hansen 208 posts 129 karma points
    Feb 03, 2010 @ 14:40
    Per Ploug Hansen
    1

    Dictionary items do not end up in the UmbracoNode table. they have their own tables called cmsDictionary and cmsLanguageText

    The current limit of a dictionary item string is 1000, which is the sql limit on the Value Column in the cmsLanguageText table. 

    So if you need more room, you can change the lenght of the column

    /Per

  • Afif 2 posts 72 karma points
    Oct 06, 2023 @ 10:07
    Afif
    0

    Hi Per,

    I'm currently using Umbraco 10, I have tried updating the cmsLanguageText table manually from the database and change the datatype of Value column to nvarchar(max), but I'm still getting the character limit warning. Is there any step I'm missing here?

    Also, if I were to upgrade the Umbraco in the future, will it revert the changes that I've made and possibly truncated the dictionary text which will cause data loss?

    Many thanks, Afif

  • Dan Evans 629 posts 1016 karma points
    Feb 04, 2010 @ 07:03
    Dan Evans
    0

    Perfect. Making the column varchar(max) fixed the issue. I wonder if it would make sense for the column length to be larger by default?

    Thanks

    Dan

Please Sign in or register to post replies

Write your reply to:

Draft