Msg to Eml converting by RDOmessage.saveas shows broken text for Korean - outlook-redemption

Thanks for sharing us this great tool!
I tested converting msg files to eml files using AutoIt, Outlook2016, and redemption.dll Version 5.24 as follows.
#include <OutlookEX.au3>
$Application = _OL_Open() ; just for check
$Session = ObjCreate("Redemption.RDOSession")
$Session.MAPIOBJECT = $Application.Session.MAPIOBJECT ; just for check
$Msg = $Session.GetMessageFromMsgFile("d:\test\EML 변환 TEST.msg")
$Msg.Display ; just for check
$Msg.SaveAs("d:\test\Test1.eml",1024)
There is no problem with reading or showing the msg file in Outlook with redemption.dll in terms of Korean.
However, when converting eml files with SaveAs, all Korean characters are broken.
The original msg file in this test, the file converted to eml using redemption.dll, and the file converted to eml using other tools are compressed and linked.
Thanks.

Related

How download files on app mobile with PHPSpreadsheet?

for my project I'm using PHPSpreadsheet for exporting data in Excel and PDF format.
If from the website, when I press on the respective download buttons, I can easily download the .xlsx and .pdf files, I have problems with the app (iOs Swift language). In fact, when I try to download the files, I receive the following messages:
for Excel files: "the file may be damaged"
for PDF files (I open it with Chrome): "Chrome does not support this link file: ///var/mobile/Containers/Data/Application/.../Documents/name_file.pdf"
Here are the fragments of the PHP code that deal with the download:
PDF:
$ output. = '... html code';
$ mpdf = new \ Mpdf \ Mpdf ();
$ mpdf-> Bookmark ('Start of the document');
$ Mpdf-> WriteHTML ($ output);
$ mpdf-> Output ($ filename.'. pdf',
\Mpdf\Output\Destination::DOWNLOAD);
EXCEL:
$spreadsheet = new Spreadsheet(); /*----Spreadsheet object-----*/
$Excel_writer = new Xlsx($spreadsheet); /*----- Excel (Xls) Object*/
/* ...riempiendo foglio excel con i dati */
header('Content-Type: application/vnd.openxmlformats-
officedocument.spreadsheetml.sheet');
header('Content-Disposition:
attachment;filename="'.$filename.'.xlsx"');
header('Cache-Control: max-age=0');
$Excel_writer->save('php://output');
Thanks for your help!
for Excel files: "the file may be damaged"
My blind guess is that when you peek the file content you will find Headers already sent PHP message polluting your file. If that is so, just call ob_start() before you call any of your header()s.

Japanese language translation issue in CSV File - ASP.NET MVC

I am facing an issue while exporting japanese text in CSV format. Junk characters are being exported instead of original japanese text. I am using .NET MVC FileStreamResult to export records in Csv file and used encoding format as UTF8 (I have also used some other encoding format, but no luck). I debugged my code and able to convert string from memory stream and vice versa and able to see original japanese text being exported. Once exporting completed, I opened the CSV file, but only able to see junk character instead of expected text. If I open the CSV file in NotePad ( Opening the csv file in Notepad is NOT my requirement. I am referring Notepad only to verify whether i am able to see Japanese translated language ), then i can see the expected japanese text. It would be really helpful if someone please help me find root cause of this issue and provide a resolution.
Ex. 東京都品川区大崎 gets written as æ±äº¬éƒ½å“å·åŒºå¤§å´Ž
Note: I can see expected japanese text is exported properly if I opened the sample .CSV file using LibreOffice Calc, Linux default gEdit. But the issue is with opening this csv file using MS Office.
Please find the below attached code -
Controller/Action to execute while clicking on export to Csv button
================================================================================
[HttpPost]
[ValidateInput(false)]
public FileStreamResult SaveCustomerInfo()
{
return ExportToCsv();
}
================================================================================
private static FileStreamResult ExportToCsv()
{
var exportedData = new StringBuilder();
exportedData
.AppendLine("実行日,口座番号,支店番号,アカウント名,支店名,の/受益秩序,ステートメント日,入力日,お問い合わせ番号, ,Date Range")
.Append(
"CS0001,Demo FName,Demo LName,8/20/2015,\"Demo User Address\",City,Country,08830,0123456789,15813,Absolute from 8/20/2015 to 8/22/2015");
var stream = PrintingHelper.StringToMemoryStream(Encoding.UTF8, exportedData.ToString());
var fileStreamResult = new FileStreamResult(stream, "text/csv")
{
FileDownloadName =
new StringBuilder("TestExportedFileInCsv")
.Append(".csv").ToString()
};
return fileStreamResult;
}
It sound as though you haven't installed the language pack for MS Office on the machine that you are trying to open the csv on.

Get mp3/pdf files using JSoup in Groovy

I am developing an application for crawling the web using crawler4j and Jsoup. I need to parse a webpage using JSoup and check if it has zip files, pdf/doc and mp3/mov file available as a resource for download.
For zip files i did the following and it works:
Elements zip = doc.select("a[href\$=.zip]")
println "No of zip files is " + zip.size()
This code correctly tells me how many zip files are there in a page. I am not sure how to count all audio files or document files using JSoup. Any help is appreciated. Thanks.
Using the same approach I suspect it would be something like this:
Elements docs = doc.select("a[href\$=.doc]")
println "No of doc files is " + docs.size()
Elements mp3s = doc.select("a[href\$=.mp3]")
println "No of mp3 files is " + mp3s.size()
Really it's just a selector where the href attribute ends in some file extension.

Opening .doc files in Ruby

Can I open a .doc file and get that file's contents using Ruby?
If you only need the plain text content, you might want to have a look at Yomu. It's a gem whichs acts as a wrapper for Apache TIKA and it supports a variety of document formats which includes the following:
Microsoft Office OLE 2 and Office Open XML Formats (.doc, .docx, .xls, .xlsx, .ppt, .pptx)
OpenOffice.org OpenDocument Formats (.odt, .ods, .odp)
Apple iWorks Formats
Rich Text Format (.rtf)
Portable Document Format (.pdf)
The gem docx is very simple to use
require 'docx'
puts Docx::Document.open('test.docx')
or
d = Docx::Document.open('test.docx')
d.each_paragraph do |p|
puts p
end
you can find it at https://github.com/chrahunt/docx and install it by gem install docx
docx however doesn't support .doc files (word 2007 and earlier), then you can use the WIN32OLE like this:
require 'win32ole'
begin
word = WIN32OLE.connect('Word.Application')
doc = word.ActiveDocument
rescue
word = WIN32OLE.new('word.application')
path_open = 'C:\Users\...\test.doc' #yes: backslashes in windows
doc = word.Documents.Open(path_open)
end
word.visible = true
doc.Sentences.each { |x| puts x.text }
Yes and No
In Ruby you can do something like:
thedoc = `externalProgram some_file`
And so what you need is a good externalProgram.
You could look at the software library wv or the (apparently not recently updated) program antiword. I imagine there are others. OpenOffice can read doc files and export text files, so driving OO via the CLI will probably also work.
If you're on Windows, this will work: http://www.ruby-doc.org/stdlib/libdoc/win32ole/rdoc/classes/WIN32OLE.html
I recently dealt with this in a project and found that I wanted a lighter-weight library to get the text from .doc, .docx and .pdf files. DocRipper uses a combination of Antiword, grep and Poppler/pdftotext command-line tools to grab the text contents from files and return them as a utf-8 string.
dr = DocRipper::TextRipper.new('/path/to/file')
dr.text
=> "Document's text"

How to open Excel file written with incorrect character encoding in VBA

I read an Excel 2003 file with a text editor to see some markup language.
When I open the file in Excel it displays incorrect characters. On inspection of the file I see that the encoding is Windows 1252 or some such. If I manually replace this with UTF-8, my file opens fine. Ok, so far so good, I can correct the thing manually.
Now the trick is that this file is generated automatically, that I need to process it automatically (no human interaction) with limited tools on my desktop (no perl or other scripting language).
Is there any simple way to open this XL file in VBA with the correct encoding (and ignore the encoding specified in the file)?
Note, Workbook.ReloadAs does not function for me, it bails out on error (and requires manual action as the file is already open).
Or is the only way to correct the file to go through some hoops? Either: text in, check line for encoding string, replace if required, write each line to new file...; or export to csv, then import from csv again with specific encoding, save as xls?
Any hints appreciated.
EDIT:
ADODB did not work for me (XL says user defined type, not defined).
I solved my problem with a workaround:
name2 = Replace(name, ".xls", ".txt")
Set wb = Workbooks.Open(name, True, True) ' open read-only
Set ws = wb.Worksheets(1)
ws.SaveAs FileName:=name2, FileFormat:=xlCSV
wb.Close False ' close workbook without saving changes
Set wb = Nothing ' free memory
Workbooks.OpenText FileName:=name2, _
Origin:=65001, _
DataType:=xlDelimited, _
Comma:=True
Well I think you can do it from another workbook. Add a reference to AcitiveX Data Objects, then add this sub:
Sub Encode(ByVal sPath$, Optional SetChar$ = "UTF-8")
Dim stream As ADODB.stream
Set stream = New ADODB.stream
With stream
.Open
.LoadFromFile sPath ' Loads a File
.Charset = SetChar ' sets stream encoding (UTF-8)
.SaveToFile sPath, adSaveCreateOverWrite
.Close
End With
Set stream = Nothing
Workbooks.Open sPath
End Sub
Then call this sub with the path to file with the off encoding.

Resources