SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot phpguru's Avatar
    Join Date
    Sep 2005
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript replace with Unicode character

    Here's my string:

    [aaa:giải trí][bbb:thử nghiệm]

    so, how can i replace "giải trí" by other string ?
    i used \w , but nothing happend

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    "[aaa:giải trí][bbb:thử nghiệm]".replace(new RegExp("giải trí"), "æblegrød")
    Javascript uses unicode internally, so the only thing to watch out for, is that data gets transported correctly into javascript. Once it's in, all characters are equal.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •