Partager via


Internet Explorer wordwrap doesn't break at commas

I was modifying my web based thumbnail image viewer. Under each thumb I wanted the description of the photo. I wanted the photos to have captions below, and the unit to be rendered horizontally so they will fill the IE width. However, Internet Explorer will not break a line to wordwrap text after a comma if there is no space after it “like,this”. I didn’t want to modify the text in the database and insert spaces. One solution would be to find all occurrences of comma followed by a non-space and replace with comma space plus the non-space character. A simpler way: I just added a line to the HTML generator:

      notes= STRTRAN(STRTRAN(notes,",",", ")," "," ") && so IE wordwraps

First it replaces all commas with comma space, then it replaces all double spaces with a single space. This is extra work if the comma already had a space after it, but it was easy to do and the amount of extra work is peanuts compared to the disk I/O to get the thumbnail image.

Comments

  • Anonymous
    August 03, 2005
    [url=http://music.tt33.net]在线音乐[/url]
    [url=http://movie.tt33.net]免费电影[/url]
    [url=http://game.tt33.net]小游戏[/url]
    [url=http://www.tt22.net]娱乐中心[/url]
    [url=http://music.tt22.net]音乐宝典[/url]
    [url=http://movie.tt22.net]在线电影[/url]
    [url=http://game.tt22.net]小游戏中心[/url]
    [url=http://lrc.tt22.net]歌词宝典[/url]
    [url=http://www.tt55.net]在线小游戏[/url]
  • Anonymous
    August 03, 2005

    So you are going to replace commas in number thousand operators for instance. Cool, I can't wait to see this.
  • Anonymous
    August 04, 2005
    Calvin,

    In addition to the issue with thousand seperators, there's also the issue of commas embedded in URL's that may also be in your notes?

    Also, I've found that I need to put space compression in a loop if you think there will be more than 5 spaces in a row in your content, i.e.

    do while " " $ lcStr
    lcStr = strtran( lcStr, " ", " " )
    enddo

    Malcolm
  • Anonymous
    August 04, 2005
    From the original post of replacing double spaces with single space, why bother to do so? I thought HTML will treat multiple spaces as one.
  • Anonymous
    August 05, 2005
    Since my photograph descriptions don't have large numbers or URLs, the issues of commas as thousands separator or in URLs don't matter to me. I wanted the descriptions to wordwrap and fit under the thumbnails, using DIV tags. IE will automatically wordwrap, but only at spaces.