Convert ASCII box drawing into Unicode I am shamelessly posting a request for something I would actually find useful.  The task is to take an arbitrary ascii box drawing like this

     |
+----+----+
| state A +---+
+---------+   |
              |
         +----v----+
         | state B |
         +---------+


... and turn it into something more beautiful using unicode box drawing characters, e.g.

     │
╭────┴────╮
│ state A ├───╮
╰─────────╯   │
              │
         ╭────v────╮
         │ state B │
         ╰─────────╯


In more detail:


convert only + - | characters - other characters should be unchanged
use


BOX DRAWINGS LIGHT VERTICAL (U+2502) │
BOX DRAWINGS LIGHT HORIZONTAL (U+2500) ─
BOX DRAWINGS LIGHT ARC DOWN AND RIGHT (U+256D) ╭
BOX DRAWINGS LIGHT ARC DOWN AND LEFT (U+256E) ╮
BOX DRAWINGS LIGHT ARC UP AND LEFT (U+256F) ╯
BOX DRAWINGS LIGHT ARC UP AND RIGHT (U+2570) ╰
BOX DRAWINGS LIGHT VERTICAL AND LEFT (U+2524) ┤
BOX DRAWINGS LIGHT VERTICAL AND RIGHT (U+251C) ├
BOX DRAWINGS LIGHT DOWN AND HORIZONTAL (U+252C) ┬
BOX DRAWINGS LIGHT UP AND HORIZONTAL (U+2534) ┴
BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL (U+253C) ┼
- always replaced with U+2500
| always replaced with U+2502
+ is replaced with a unicode character that depends on the 4 characters north, south, east and west of it (if they exist)
&lt; and > are treated as vertical wall segments if north or south of a + (so that you can have arrows terminating in vertical walls of a box)
v and ^ are treated as horizontal wall segments if east or west of a + (so that you can have arrows terminating in horizontal walls of a box)
+ is treated as a wall segment if either north, south, east or west of a + (so that lines can connect next to a box corner) 



Testcases

+-+     +---+   +---+   |
| +--   |ABC|  -+   |  +++
+-+     ++--+   +---+  +-+
         |
         +---&gt;
  |           +--+
+-v+   +---+  |  |  +-----+
|Hi|  -&gt;   |  +^-+  |world&lt;-----+
+--+   +---+   |    +-----+     |
               |                +--
   |
---+---
   |


Becomes

╭─╮     ╭───╮   ╭───╮   │
│ ├──   │ABC│  ─┤   │  ╭┴╮
╰─╯     ╰┬──╯   ╰───╯  ╰─╯
         │
         ╰───&gt;
  │           ╭──╮
╭─v╮   ╭───╮  │  │  ╭─────╮
│Hi│  ─&gt;   │  ╰^─╯  │world&lt;─────╮
╰──╯   ╰───╯   │    ╰─────╯     │
               │                ╰──
   │
───┼───
   │


Shortest code wins!
JavaScript (ES6), 236 bytes

s=&gt;`
${s}
`.split`
`.map((l,i,a)=&gt;l.replace(/[+-|]/g,(c,j)=&gt;c&gt;`-`?`│`:c&gt;`+`?`─`:`┼┬├╭┤╮??┴?╰?╯`[g(a[i-1][j])+g(l[j-1],1)*2+g(l[j+1],1)*4+g(a[i+1][j])*8]),g=(c,f)=&gt;(f?`+-^v`:`+&lt;&gt;|`).indexOf(c)&lt;0).slice(1,-1).join`
`