Change Hex character strings to HTML entities

Hi!

I am not a whiz at awk and very unsure about the aplication of awk solve my problem. I was hoping for some quick pointers so I can figure this out.

I have a file that looks like so:

label.Asked=\u8CEA\u554F\u6E08\u307F
button.Edit=\u7DE8\u96C6
data.menu.WorkWeekProfile=<li>\u5E73\u65E5\u30D7<b>\u30ED\u30D5</b>\u30A3\u30FC\u30EB</li>

Now, I want this to be changed into:

label.Asked=<br />
button.Edit=<br />
data.menu.WorkWeekProfile=<li><b></b></li><br />

Notice that I want to change each unicode value to its HTML entity form, while adding a BR tag at the end of each line so it is formatted appropriately in HTML.

A simple find replace does not work since I have to work around already embedded HTML tags. Any help is much apreciated!

Why is this line treated differently?

data.menu.WorkWeekProfile=<li><b></b></li><br />

I see that you added additional <li> and <b> tags.

I am so sorry, I just fixed my original post. The source file also has the HTML tags in it.

Hello, pinocchio:

$ cat data
label.Asked=\u8CEA\u554F\u6E08\u307F
button.Edit=\u7DE8\u96C6
data.menu.WorkWeekProfile=<li>\u5E73\u65E5\u30D7<b>\u30ED\u30D5</b>\u30A3\u30FC\u30EB</li>

$ sed 's/\\u\([[:xdigit:]]\{4\}\)/\&#x\1;/g; s/$/<br \/>/' data
label.Asked=<br />
button.Edit=<br />
data.menu.WorkWeekProfile=<li><b></b></li><br />

Regards,
Alister