Convert ANSI Text file to UTF-8 Encoding using Aspose.Words RESTful API

Hi,


we would like to use the Cloud API to convert an ANSI character set into an UTF-8 one.
1. How can we do this? Can you please give an example?
2. Will the conversion support character set (ISO, Windows, OEM)? Is it possible for the conversion choose the charset without guidance?

Thanks.
Yishay

Hi Yishay,

You can specify save options when converting your files. TxtSaveOptions can be used in this case to change the encoding of a text file.

If you do not specify any encoding, it will be saved to UTF-8 because this is the default encoding when saving to a text file.

Best Regards,

Hi Muhammad,


that’s great.
Just making sure, the steps are:
1. Upload the file to some temporary storage.
2. Use saveAs POST command with an TextSaveOptions XML in the body.
2.1. The converted document will reside in a link that will be in the response from the sever.
3. Download the converted file from the server.
4. Delete the temporary file…

a. Is this correct?
b. Will this conversion take care of charterset (ISO, Windows, OEM)?

Thanks,
Yishay

Hi Yishay,

a. Yes, that is correct. The only difference is that you will pass FileName in TxtSaveOptions and use that file name to download output file.

b. Yes, it should. You can report in the forums if you see any issue.

Best Regards,

Hi Muhammad,


in the documentation example you have two variables to do the same task.
The file name. e.g. MyFolder/outFile.tiff
The document folder.

Which one is the correct one to send the document folder in?

Thanks,
Yishay

Hi Muhammad,


Regarding your answer: Yes, that is correct. The only difference is that you will pass FileName in TxtSaveOptions and use that file name to download output file." will the created file reside in the same folder as the source file?

Thanks,
Yishay

Hi Muhammad,


until you answer our previous couple of posts we tried what you offered with no folder and we got a few issues:
1. We upload the file in order to use the saveAs, but when we call the saveAs we receive an error as if the file is not there.
2. We left the same file from the first round on the servers (it did uploaded in the first round, but we still got the error), but than we get a second error:
Error: Format “text/txt” is unknown. Method: Save the document as… Parameters: name ‘test skn.txt’, saveOptionsData ‘SaaSpose.API.Business.Words.DTO.Saving.TextSaveOptionsData’, storage ‘’, folder ''

Please assist, Thanks.
Yishay

Hi Yishay,

Both parameters are correct. Folder parameter is used for input document and you can specify the folder where your input file is. Name parameter is used to specify output file name. You can pass the file name if you can save the output file to the root folder or specify FolderPath/FileName if you want to save the output file to a specific folder.

Best Regards,

Hi Yishay,

As far as the errors mentioned in your latest post are concerned, can you please share the input text file for further analysis?

Best Regards,

Hi Muhammad,


file attached.
I still need you to address the other point which is very crucial
We upload the file in order to use the saveAs, but when we call the saveAs we receive an error as if the file is not there.

Thanks,
Yishay

Hi Yishay,

We are investigating your file. As far as file not found is concerned, you need to use folder parameter to set the path. If your file is present on the root of your storage, you can pass the file name in the URI like the following.

http://api.aspose.com/v1.1/words/4623(2)(1).txt/SaveAs

If your file is inside a folder, you need to use folder parameter in this case to specify the path in the URI as you can see in the following example.

http://api.aspose.com/v1.1/words/4623(2)(1).txt/SaveAs?folder=Folder1/SubFolder1

Best Regards,


Hi Muhammad,

I'm sorry, but I didn't explained myself.
We are not using folders yet, there is some synchronization issue, when we upload the file and immediately try to use the SaveAs functionality we get an error as if the file is not there.
I guess you have some performance issue where the file isn't indexed or something of this sort, because when we run the same action again (without deleting the file) we don't get the error.
Please check this also, because we cannot use the functionality with this issue, because there is no workaround for this issue.

Thanks,
Yishay

Hi Yishay,

I was not able to see this issue at my end. We are investigating why you are noticing such issue and will update you soon.

Best Regards,

Hi Muhammad,


Any progress with this issue.
This is one of the features that we really long for.

Thanks,
Yishay

Hi Yishay,

Sorry, we were not able to reproduce this issue at our end and no other customers reported such issue. The files are available for further processing immediately after the upload and there is no delay. You can check if the file exists immediately after the upload by using this example http://www.aspose.com/docs/display/totalcloud/Check+Presence+of+a+File and share your findings with us.

If the problem persists, please share your complete code for further investigation and also share your log file with this type of errors.

Best Regards,

Hi Muhammad,


I was actually reffering this issue that I posted a few posts ago:
2. We left the same file from the first round on the servers (it did uploaded in the first round, but we still got the error), but than we get a second error:
Error: Format “text/txt” is unknown. Method: Save the document as… Parameters: name ‘test skn.txt’, saveOptionsData ‘SaaSpose.API.Business.Words.DTO.Saving.TextSaveOptionsData’, storage ‘’, folder ''
Any progress with this issue?

Thanks,
Yishay

Hi Yishay,

I was not able to notice this issue. Looks like you have passed text/txt as the SaveFormat which is not valid; you should pass txt as SaveFormat e.g. I have used the following XML at my end without any issue.

<TextSaveOptions>

<SaveFormat>txt</SaveFormat>

<FileName>Encoding_Updated.txt</FileName>

<Encoding>UTF-8</Encoding>

</TextSaveOptions>

Best Regards,

Hi Muhammad,


Great that works! I thought I toke it from your documentation, but I probably had a mistake.
Another related question, do you support Code Page?

Thanks,
Yishay

Hi Yishay,

Yes, it is supported by by Aspose.Words.

Best Regards,

Hi Muhammad,


that’s great! but we couldn’t find it in the documentation.
Can you please refer us to the manual or write us how to do it?

Thanks,
Yishay