I am trying to read a .txt file and write it to .csv, the actual data is in utf-8 and I want the data to be encoded to shift-JIS(Japanese). How do I do this?
Or
OR
API File.WriteXXX Method
Also let us know whicht TargetFramework is used, For Windows maybe the EncodingProvider is ot register before
Also have a look here for encoding ootb availability
Encoding retrieval e.g.:
I am facing this issue:
22.10.3+Branch.master.Sha.def2351dc828ccfbcddb6e9e07c9cf71b5bf55da
Source: Write Text File
Message: One or more errors occurred. (âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ)) (âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ)) (âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ))
Exception Type: System.AggregateException
System.AggregateException: One or more errors occurred. (âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ)) (âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ)) (âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ)) â> System.ArgumentException: âshift_jisâ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ânameâ) at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
at System.Text.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
at UiPath.Core.Activities.WriteTextFile.<>c__DisplayClass18_0.b__0()
at UiPath.Core.Activities.Retry.<>c__DisplayClass1_0.b__0()
at UiPath.Core.Activities.Retry.Do[ResultType](Func1 action, Int32 timeoutMS, Int32 retryCount) --- End of inner exception stack trace --- at UiPath.Core.Activities.TaskAsyncCodeActivity
1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
as mentioned:
have a look there:
I have followed the above solution and used the Invoke Method for encoding.
ReadTextFile->Encoding->us-ascii
WriteTextFile->Encoding->shift_jis
But still my output file data is not encoded to Japanese(Shift-JIS) format instead my data is being written like this:
11?l???t
12???
14???l
15???
which is again âus-asciiâ format.
Hi,
If you need to read shift_jis encoded text, perhaps you should set âshift_jisâ at Encoding property of ReadTextFile activity.
If possible, can you share your text file? We might be able to check it.
Regards,
Iâve tried shuft_jis but Iâve got this error:
ââshuft_jisâ is not a supported encoding name.â
I want to read â1252: Western Europian (Windows)â encoded text and write it to a csv in â932: Japanese (Shift-JIS)â encoded format
HI,
Can you try as the following?
Set âWindows-1252â at Encoding property of ReadTextFile
Set âshift_jisâ at Encoding property of WriteTextFile
Please note that if there are some characters which the other encoding doesnât have, it might be â?â character.
And can you share your file? Itâs no problem, if dummy data.
Sorry, shuft_jis is my typo. It shoulkd be shift_jis.
Regards,
Iâve tried this:
Set âWindows-1252â at Encoding property of ReadTextFile
Set âshift_jisâ at Encoding property of WriteTextFile
but got this error: ââWindows-1252â is not a supported encoding name.â
Kindly refer to the attached text file,
data.txt (337 Bytes)
Hi,
Unfortunately, some characters in your file are not contains Shift-JIS character set.
Perhaps you should save this as UTF-8, i think.
Regards,
Does setting the Encoding property of ReadTextFile as âUTF-8â reads that text file in utf-8 format?
Nope, it should be windows-1252. Can you try the following sample? This outputs read your text as windows-1252 then output it to UTF-8 and Shift-JIS.
Sample20221202-3net.zip (2.6 KB)
Regards,
Itâs still not encoded to shift-jis.
HI,
Itâs impossible because some characters in your file are not contains Shift-JIS character set.
Shift-JIS has about 9000 characters but doesnât include some of Windows-1252.
Regards,
Understood. Thanks a lot.
Hi.
Shift-JIS encoding format is not supported in windows, hence I tried with â932â encoding format and the Japanese characters has been read and written to csv.
Hi,
CP932 is mostly(99.9%) same as âShift_JISâ and .net supports both encoding. Can you share your situation in details?
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.