Office Word Add-In Chinese garbled when get html from document body - office-addins

I am going to display the content of the current word document on Add-in Taskpane, I can achieve this simple task by calling context.document.body.getHtml() from which gets an HTML representation of the body object.
But the chinese characters in this html is garbled which means they represent nothing.
For example:
我爱我的家(I love my family) becomes 辨瀹都(Nobody knows what is this)
Hope someone can help. Thanks

Related

how to render data generated by text-editor

I am using this (Tiny) text editor in the web platform. Able to integrate basic editor also
Now problem i am facing is how to render output html data(which is in the string format) like this
so output data in string format is like this :
please help me out to render this string formatted data in a separate block.
whole idea is like this i need a rich text editor like stackoverflow/medium and want to render the data in a separate location. I'm little confused about all this please help me out or suggest a better approach to handle this.

google structured data testing tool displays question mark character instead of utf-8 characters

After testing URL in the google structured data testing tool, I don't know why the question mark character is shown instead of utf-8 characters?
what is wrong? any help really appreciated.
the url is : link
and the result image:
The underlying json is:
don't know why, but the structured data tool doesn't understand your farsi. If farsi is an encoded javascript, like \u0645\u0648\u0633\u0633\u0647 - there is no problem. But if it is written like علائم تیروئید کم کار - something wired happens.
Fast and dirty solution: encode all of your structured data content as encoded javascript. In Notepad++ this makes a plugin named HTML Tag - then ctrl+j.

How blog contents are stored in database?

I have a doubt in creating a blog. Take stackoverflow.com as example, In this, ask question or answer segment have a WYSIWYG like editor. If i use some href link or other html tags within my answer how the data format stored in database(In HTML or plain text or any other).
In case data is stored in HTML format, then how it is converted simple json for connecting with mobile app webservice's.
In simple question, In which format user data is stored in database and how it is used for further processing.
I'm not sure how it works on Stack Overflow, but I think the text is stored in database in plain text format but with special characters like:
[link](http://example.com); _italic_; **bold**
And then these symbols are replaced with actual markup

format document WebPage via Windows Forms Application?

So, I'm building a windows forms application that uses a StreamReader/StreamWriter to read each line of the .aspx, .ascx and .master pages on our asp.net website. It then removes certain properties and such from the controls through string manipulation, and writes the result back (overriding the page's markup with the edited markup). The problem is some of these pages are being written as one continuous line.
I've been unable to find anyway to call the visual studios 'Format Document' function. I found this question that would likely accomplish my goal if I weren't trying to do this from my Windows Form Application (as it's an automated process).
Any tips or points in the right direction would be appreciated.
A quick-and-dirty-solution would be (and I don't recommend it):
content = content.Replace("></", ">></").Replace("><", ">\n\t<").Replace(">></", "></");
content is the string that holds the web content.
First and last replacements are to avoid the second replacement to add newlines between something like this <tag></tag>. The above code of course has some flaws. Something like <tag1><tag2 /></tag1> will not be formatted correctly. You could avoid this by pre-replacing /></ with something you can safely re-replace at the end.
You may also want to replace \n with \r\n perhaps.

DotNetNuke parse HTML before display

Could anyone tell me if there's some way of "hooking in" to DotNetNuke so that I can, for example, search and replace text for ALL HTML modules on the site?
e.g. if I use an HTML editor and enter the text {{replace_me}}, then I could have some code that detects "{{replace_me}}" every time a page is rendered and replace it with something else.
Please note that this is a simple example - there may be other ways of "replacing" text - however the actual use case we have is very specific and there will be some significant processing to decide what to replace :) - so whatever solution we implement should basically be:
Get HTML from DB -> Process it however we wish in full C# -> Deliver the modified string.
Thanks!
I believe you can do this with the use of an HTTPModule. Ifinity.com.au used to sell a module that did this, looks like you might be able to download it now for free (maybe?) at http://www.ifinity.com.au/Products/Inline_Link_Master/Product_Details

Resources