Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabulation character not displayed whereas accents are working #168

Open
natoli66 opened this issue Aug 29, 2017 · 13 comments
Open

Tabulation character not displayed whereas accents are working #168

natoli66 opened this issue Aug 29, 2017 · 13 comments
Labels

Comments

@natoli66
Copy link

Hi everybody,

I'm currently using latest version (1.40.4) and I have a weird bug, I really hope you can help me figuring out what it is.

So I'm using the engine to get some data from my website and for some reason accents and special chars are displayed and work perfectly, example :
French sentence I receive : "S'est adapt\U00e9 rapidement \U00e0 son poste"

Whereas a tab character is not displayed
I get "RESOCPRO_69_94_A-VII"
which should be "RESOCPRO_69_94_A-VII\u0009"

I tried to print data as utf8 encoded this way

func soapEngine(_ soapEngine: SOAPEngine!, didBeforeParsingResponseData data: Data!) -> Data! {
        print(String(data: data, encoding: .utf8))
        return data
}

And I got "RESOCPRO_69_94_A-VII\t" we can see that the tabulation is present.

The thing is that I can't return the right data...

I really don't understand why accents are working and not tabs thought, I tried to get the same data using php soap client and it worked.

priore added a commit that referenced this issue Aug 29, 2017
@priore priore added the bug label Aug 29, 2017
@priore
Copy link
Owner

priore commented Aug 29, 2017

Please, download the last updated version 1.40.5.

Thanks.

@natoli66
Copy link
Author

natoli66 commented Aug 30, 2017

Thank you for your fast answer but I updated and it is still not working...
I have the same result.

Btw I don't know if I understood well the update you made but I don't think my server is sending both unicode and utf8 (I don't know the subject really well either but I know my server only sends data encoded the same way).

Trying to help here but I might have failed, still I can help you if you have any question.

@priore
Copy link
Owner

priore commented Aug 30, 2017

Please, verify the version on your SOAPEngine, on .h file, from our tests the text conversion containing accented letters or unicode characters or both, is right.

@natoli66
Copy link
Author

natoli66 commented Aug 30, 2017

// Version : 1.40.5

The thing is I don't think my server is sending unicode, I don't know how I can help maybe I can send you the raw request response ?

@priore
Copy link
Owner

priore commented Aug 30, 2017 via email

@natoli66
Copy link
Author

I've sent an email to [email protected].

@priore
Copy link
Owner

priore commented Aug 30, 2017

The internal XML parser of SOAPEngine truncate the invalid characters for default, we know this is a limitation but with the next version (2.0) this limitation will no longer exist, why we will totally change the parser.

In the waiting can replace the parser following the information of this TBXML link, obtaining an increase of speed, this should also solve the problem.

@natoli66
Copy link
Author

Do you have any tip on how to install TBXML I download your version with cocoapods but it seems that the bridging header I made doesn't work, still I have 50 errors pointing directly at TBXML framework.

@priore
Copy link
Owner

priore commented Aug 30, 2017

Sorry, for Swift use the UTXMLDictionary pod, it that is based on TBXML:

import UIKit
import SOAPEngine64
import UTXMLDictionary

class ViewController: UIViewController, SOAPEngineDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let soap = SOAPEngine()
        soap.responseHeader = true
        soap.actionNamespaceSlash = true
        soap.delegate = self
        
        soap.setValue("Genesis", forKey: "BookName")
        soap.setIntegerValue(1, forKey: "chapter")
        soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
                        soapAction: "http://www.prioregroup.com/GetVerses")
        
    }
    
    func soapEngine(_ soapEngine: SOAPEngine!, didBeforeParsingResponseData data: Data!) -> Data! {
        
        let dict = UTXMLDictionary.dictionary(fromXMLData: data) as! [String : AnyObject]
        debugPrint(dict)
        
        return nil
    }
    
    func soapEngine(_ soapEngine: SOAPEngine!, didFailWithError error: Error!) {
        
        debugPrint(error)
    }

}

@natoli66
Copy link
Author

Thanks for giving me this link, but I still have the same problem even with UTXMLDictionary when I print data the way you showed me, the tabulation character is still not present.
But it's okay I think I'll find another way to solve it until you release the v2, do you plan on releasing it soon though ?

@priore
Copy link
Owner

priore commented Aug 31, 2017

Hello,
add pod declaration as below, before UTXMLDictionary pod, is a modified version to recover the original value without lose spaces or special characters like the tabulator.

pod "TBXML", :git => 'https://github.com/priore/TBXML.git'

@natoli66
Copy link
Author

natoli66 commented Aug 31, 2017

Getting those 50 build time errors again concerning TBXML as when I tried to use it alone...

@priore
Copy link
Owner

priore commented Aug 31, 2017

For now the only solution found is to import directly the TBXML classes (from the GitHub Priore), then remove them from the pod TBXML and UTXMLDictionary and use the TBXML cetegory that exposes the TBXML.dictionary(withXMLData: ..) method, but remember to add the libz library (Target -> Build Phases -> LInk Binary...) and import TBXML and TBXML+NSDictionary in the bridge file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants