support: Customer Portal
Focused on delivering choice, investment protection and flexibility to organizations with valuable COBOL assets
 

Veryant Knowledge Base
Home > All Categories > isCOBOL General > Deployment > How can I encode a URL String?
Question Title How can I encode a URL String?

You can work with the OOP statements using the Java class named "java.net.URLEncoder", available with the Java Runtime, useful to encode a URL string: http://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html

The following is an example of a COBOL program that encodes a string using UTF-8 as the encoding scheme:


program-id. pencode.
configuration section.
repository.
 class jencoder as "java.net.URLEncoder"
 class jstring as "java.lang.String"
 class jencodeEx as "java.io.UnsupportedEncodingException"
 .
       
working-storage section.
77 w-jencoder object reference jencoder.
77 w-string object reference jstring.
77 var pic x any length.
       
procedure division.
main.
 try
    set w-string to jstring:>new(""The string ΓΌ@foo-bar")
    set var to jencoder:>encode(w-string, "UTF-8")      
    display var
 catch jencodeEx
    display exception-object
 end-try.   
 stop run.

Authored by: Veryant Support This question has been viewed 5507 times so far.
Click Here to View all the questions in Deployment category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
How helpful was this article to you?
User Comments User Comments Add Comment
There are no user comments for this question. Be the first to post a comment. Click Here
Related Questions Related Questions
  1. Did you know you can create temporary files in memory?
  2. What are the minimum files I need for a runtime-only installation? How do I create a launcher?
  3. Working with sequential files on Pipes
  4. Did you know isCOBOL IDE allows you to easily understand how to invoke a method in a Java Class?
  5. How do I generate an executable for deployment?
  6. What can I use to perform an email validation during entry-field accept?
  7. How do I create an installation package for my COBOL application?
  8. Is there a way to to emulate the W$GETC routine?
  9. Did you know isCOBOL IDE allows you to easily understand how to invoke a method in a Java Class?
  10. Did you know you could choose from different languages for isCOBOL message?
  11. Did you know you could set a background image from isCOBOL IDE's painter?
  12. How can I read data correctly from a line-sequential file that has a different encoding from the one used by isCOBOL?
  13. Did you know these two ways of finding out the working directory in use?
  14. Can I mix versions of Java, isCOBOL compiler and isCOBOL runtime?
  15. How can I read a data written with a different encoding?
Article Information Additional Information
Article Number: 211
Created: 2013-10-25 11:33 AM
Rating: 5 Stars
 
Article Options Article Options
Print Question Print this Question
Email Question Email Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Subscribe to Article Subscribe to Article
 
Search Knowledge Base Search Knowledge Base



 
 

© Veryant - All Rights Reserved
Veryant and isCOBOL are trademarks or registered marks of Veryant in the United States and other countries. All other marks are the property of their respective owners.