cancel
Showing results for 
Search instead for 
Did you mean: 

File Upload - File Name in Hebrew problem

Former Member
0 Kudos

Hi all,

I am using file upload with IWDResource in NW04s and while loading files with hebrew encoding I am getting gibrish when using

getResourceName()

method.

I also tried working with data and fileName properties - both giving null.

Any ideas?

Thanks,

Aviad

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Levy,

Use this code in action button for upload a file

Here up is a context attribute of type "com.sap.ide.webdynpro.uielementdefinitions.Resource"

It is to be bind with upload UI element property called "resource"

InputStream text = null;

int temp = 0;

try

{

File file = new File(wdContext.currentContextElement().getUp().getResourceName());

FileOutputStream op = new FileOutputStream(file);

if(wdContext.currentContextElement().getUp()!=null)

{

text = wdContext.currentContextElement().getUp().read(false);

while((temp=text.read())!=-1)

{

op.write(temp);

}

}

op.flush();

op.close();

String path = file.getAbsolutePath();

wdComponentAPI.getMessageManager().reportSuccess(path);

}

catch(Exception e)

{

e.printStackTrace();

}

Former Member
0 Kudos

Hi Sathish,

The problem is not with the upload process but with the file name when using - wdContext.currentContextElement().getUp().getResourceName().

I get squares and question marks instead of the file name.

I have no problem loading files with english file names.

Aviad

Former Member
0 Kudos

Hi Levy,

U will get the file name using file.toString()method.like below

File file = new File(wdContext.currentContextElement().getUp().getResourceName());
		wdComponentAPI.getMessageManager().reportSuccess(file.toString());

Former Member
0 Kudos

Hi,

No - I still get the squares and question marks instead of the name.

Aviad

Former Member
0 Kudos

Hi Levy,

U use the upload attribute type as <b>com.sap.ide.webdynpro.uielementdefinitions.Resource</b>

this is to available in Dictionary simple type.

Former Member
0 Kudos

Hi,

yes - I use <b>com.sap.ide.webdynpro.uielementdefinitions.Resource</b>

If the file name is english everything works smothly.

Aviad

Former Member
0 Kudos

You said that you "get squares...". What does that mean exactly?

Armin

Former Member
0 Kudos

Hi Armin,

Instead of regular hebrew chars I get squares and question marks.

Here is an example of a file name :

&#1514;&#65533;?&#1511;&#65533;?&#1504;&#65533;?&#65533;? &#65533;?&#65533;?&#1508;&#65533;?&#65533;?&#1511;&#1510;&#65533;?&#65533;?&#1514; &#65533;?&#65533;?&#1513;&#65533;?&#1514; &#65533;?&#1514;&#65533;?&#65533;?&#65533;?&#65533;?&#65533;?&#1514;.doc

Aviad

Former Member
0 Kudos

Yes, but how do you get this string? Do you see it in the debugger, or do you see it as text of some UI element etc?

Armin

Former Member
0 Kudos

I see it both in the debugger and in the UI element link text property

If I use the

getUrl(WDFileDownloadBehaviour.AUTO.ordinal())

I get unicode representation of the name (e.g. %EF%D6%8H....)

Aviad

Former Member
0 Kudos

Which means that IWDResource.getResourceName() does not handle the encoding correctly? In that case, please open an OSS message (BC-WD-JAV-RUN).

Armin

Former Member
0 Kudos

Hi Armin,

OSS Message created.

Thanks,

Aviad

Former Member
0 Kudos

Hi Aviad

when upload a file of chinese name,I faced the same problem.

Have you got the solution ?

Former Member
0 Kudos

Hi,

No response from SAP yet.

As soon as i get something I will post it here.

Watch This thread for further updates.

Aviad

Former Member
0 Kudos

I am expecting your solution.

Thanks for your reply.

o(&#8745;_&#8745;)o...

Former Member
0 Kudos

Hi,

SAP response is as follows:

Could you please let us know if you have applied the latest patch for SP09?

If not could you please apply the patch according to the note :

<b>982023</b> and let us know if the problem persists?

I haven't tried it yet.

Aviad